diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 78901fa2bf4..45d5a9e59ca 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -667,8 +667,7 @@ static int parse_request(uint8_t code, uint8_t len, const void *option, void *us if (!data) return -ENOMEM; - free(req->client_id.data); - req->client_id.data = data; + free_and_replace(req->client_id.data, data); req->client_id.length = len; }