summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-link.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 9d570e0146..78e96c4e5b 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2059,10 +2059,9 @@ int link_update(Link *link, sd_netlink_message *m) {
link_free_carrier_maps(link);
- free(link->ifname);
- link->ifname = strdup(ifname);
- if (!link->ifname)
- return -ENOMEM;
+ r = free_and_strdup(&link->ifname, ifname);
+ if (r < 0)
+ return r;
r = link_new_carrier_maps(link);
if (r < 0)