summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@gmail.com>2015-08-04 11:31:03 +0530
committerSusant Sahani <ssahani@gmail.com>2015-08-04 11:31:03 +0530
commitbff92d2c2f913c368d80066ee89855665818edc8 (patch)
tree7b8c4b67283a424e111b125b66b7aa3d95445354 /src
parent195c9e37fcb1273b92e2cdacc1d0aa573bf7a92d (diff)
networkd: DHCP fix CID 1315105
CID 1315105: Resource leaks (RESOURCE_LEAK) /src/libsystemd-network/sd-dhcp-server.c: 800 in dhcp_server_handle_message() *** CID 1315105: Resource leaks (RESOURCE_LEAK) /src/libsystemd-network/sd-dhcp-server.c: 800 in
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index d2cc3194b3..a0af256dee 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -796,8 +796,12 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
r = sd_event_now(server->event,
clock_boottime_or_monotonic(),
&time_now);
- if (r < 0)
+ if (r < 0) {
+ if (!existing_lease)
+ dhcp_lease_free(lease);
return r;
+ }
+
lease->expiration = req->lifetime * USEC_PER_SEC + time_now;
r = server_send_ack(server, req, address);