summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-06-13 22:54:22 +0200
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-06-18 23:21:00 +0200
commit02557f973aed0fed7154fefe53d67e2935f918dc (patch)
tree4cb02d41d83845072f4889034c63ff0a6ba02b75
parent7826397d925d92e813039fa0d2614ee7d2ecc808 (diff)
sd-dhcp-server: fix a leak
We must use free instead of dhcp_lease_free here to avoid freeing client_id.data.
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index 4ce10549d6..d9495024ab 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -697,8 +697,10 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
lease->address = req->requested_ip;
lease->client_id.data = memdup(req->client_id.data,
req->client_id.length);
- if (!lease->client_id.data)
+ if (!lease->client_id.data) {
+ free(lease);
return -ENOMEM;
+ }
lease->client_id.length = req->client_id.length;
} else
lease = existing_lease;