summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index f196a3f3dd..eae186c9d3 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -561,11 +561,10 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const uint8_t *option,
if (e)
*e = 0;
- if (!hostname_is_valid(hostname) || is_localhost(hostname))
+ if (!hostname_is_valid(hostname, false) || is_localhost(hostname))
break;
- free(lease->hostname);
- lease->hostname = hostname;
+ free_and_replace(&lease->hostname, hostname);
hostname = NULL;
break;