summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-server.c')
-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;