1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00

libsystemd-network: fix memory leak

This commit is contained in:
reverendhomer 2015-08-08 14:24:11 +03:00
parent b28098571b
commit 626be147a6

View File

@ -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++) { 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; size_t len;
if (!options[i]) if (!options[i])
@ -965,10 +965,8 @@ int sd_dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
return r; return r;
r = dhcp_lease_insert_private_option(lease, DHCP_OPTION_PRIVATE_BASE + i, data, len); r = dhcp_lease_insert_private_option(lease, DHCP_OPTION_PRIVATE_BASE + i, data, len);
if (r < 0) { if (r < 0)
free(data);
return r; return r;
}
} }
*ret = lease; *ret = lease;