From 78eee6ce4d45528e63d0857b4629de39a2140db5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 19 Mar 2021 22:45:28 +0100 Subject: [PATCH] repart: use free_and_strdup_warn() where appropriate --- src/partition/repart.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/partition/repart.c b/src/partition/repart.c index 0db8d4aba12..bbf4fbbc83b 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -3027,10 +3027,9 @@ static int context_acquire_partition_uuids_and_labels(Context *context) { p->new_uuid = p->current_uuid; if (p->current_label) { - free(p->new_label); - p->new_label = strdup(strempty(p->current_label)); - if (!p->new_label) - return log_oom(); + r = free_and_strdup_warn(&p->new_label, strempty(p->current_label)); + if (r < 0) + return r; } continue; @@ -3046,10 +3045,10 @@ static int context_acquire_partition_uuids_and_labels(Context *context) { } if (!isempty(p->current_label)) { - free(p->new_label); - p->new_label = strdup(p->current_label); /* never change initialized labels */ - if (!p->new_label) - return log_oom(); + /* never change initialized labels */ + r = free_and_strdup_warn(&p->new_label, p->current_label); + if (r < 0) + return r; } else if (!p->new_label) { /* Not explicitly set by user! */