summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-08-08 13:34:32 +0200
committerDaniel Mack <github@zonque.org>2015-08-08 13:34:32 +0200
commitaae68db9b441963b0d1b8519e0aee8e2fc05e20c (patch)
tree1803ac98ec98a0328d6d7f9462023e906f6cd08e /src
parentb28098571b3e4ab332049875db6d52a11a8d3947 (diff)
parent626be147a6b6e09e15cd6c4b51bf8cfa87fa6f56 (diff)
Merge pull request #916 from reverendhomer/patch-3
libsystemd-network: fix memory leak
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index e0874aebad..f5b9e22589 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -954,7 +954,7 @@ int sd_dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
}
for (i = 0; i <= DHCP_OPTION_PRIVATE_LAST - DHCP_OPTION_PRIVATE_BASE; i++) {
- uint8_t *data;
+ _cleanup_free_ uint8_t *data = NULL;
size_t len;
if (!options[i])
@@ -965,10 +965,8 @@ int sd_dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
return r;
r = dhcp_lease_insert_private_option(lease, DHCP_OPTION_PRIVATE_BASE + i, data, len);
- if (r < 0) {
- free(data);
+ if (r < 0)
return r;
- }
}
*ret = lease;