libsystemd-network: avoid double free on error
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 20 Jan 2016 00:50:17 +0000 (19:50 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 20 Jan 2016 23:55:55 +0000 (18:55 -0500)
This could happen if the remote sent us a badly formatted
option.

CID #1317206.

src/libsystemd-network/sd-dhcp6-lease.c

index 3f32ba3..327759e 100644 (file)
@@ -256,7 +256,7 @@ int dhcp6_lease_set_ntp(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen) {
         assert_return(lease, -EINVAL);
         assert_return(optval, -EINVAL);
 
-        free(lease->ntp);
+        lease->ntp = mfree(lease->ntp);
         lease->ntp_count = 0;
         lease->ntp_allocated = 0;