diff options
author | Tom Gundersen <teg@jklm.no> | 2014-05-19 17:44:38 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-05-19 18:14:56 +0200 |
commit | 81d98a39eb4cca743beba27f4ae21a0e199df785 (patch) | |
tree | 543793bb8fb8b400de00365020c5fd988ba6c77f | |
parent | 091a364c802e34a58f3260c9cb5db9b75c62215c (diff) |
sd-dhcp-lease/sd-network: modernization and fix leak
-rw-r--r-- | src/libsystemd-network/sd-dhcp-lease.c | 1 | ||||
-rw-r--r-- | src/network/sd-network.c | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 4993fe3641..cf71f116d1 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -174,6 +174,7 @@ sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease) { free(lease->hostname); free(lease->domainname); free(lease->dns); + free(lease->ntp); free(lease); } diff --git a/src/network/sd-network.c b/src/network/sd-network.c index 64e3aaae48..7ae15ed6ae 100644 --- a/src/network/sd-network.c +++ b/src/network/sd-network.c @@ -142,8 +142,8 @@ _public_ int sd_network_get_link_operational_state(unsigned index, char **state) } _public_ int sd_network_get_dhcp_lease(unsigned index, sd_dhcp_lease **ret) { + _cleanup_free_ char *p = NULL, *s = NULL; sd_dhcp_lease *lease; - char *p, *s = NULL; int r; assert_return(index, -EINVAL); @@ -153,12 +153,10 @@ _public_ int sd_network_get_dhcp_lease(unsigned index, sd_dhcp_lease **ret) { return -ENOMEM; r = parse_env_file(p, NEWLINE, "DHCP_LEASE", &s, NULL); - free(p); - if (r < 0) { - free(s); + if (r < 0) return r; - } else if (!s) + else if (!s) return -EIO; r = dhcp_lease_load(s, &lease); |