From 471e332d50b667c2e135248f2454e4ab72505e41 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 8 Sep 2021 13:50:59 +0900 Subject: [PATCH] network: dhcp4: use free_and_strdup_warn() --- src/network/networkd-dhcp4.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 5a6d3994c01..d38c429bd99 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -984,11 +984,9 @@ static int dhcp4_request_address(Link *link, bool announce) { addr->route_metric = link->network->dhcp_route_metric; addr->duplicate_address_detection = link->network->dhcp_send_decline ? ADDRESS_FAMILY_IPV4 : ADDRESS_FAMILY_NO; - if (link->network->dhcp_label) { - addr->label = strdup(link->network->dhcp_label); - if (!addr->label) - return log_oom(); - } + r = free_and_strdup_warn(&addr->label, link->network->dhcp_label); + if (r < 0) + return r; if (address_get(link, addr, NULL) < 0) link->dhcp4_configured = false;