summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-05-19 17:44:38 +0200
committerTom Gundersen <teg@jklm.no>2014-05-19 18:14:56 +0200
commit81d98a39eb4cca743beba27f4ae21a0e199df785 (patch)
tree543793bb8fb8b400de00365020c5fd988ba6c77f /src/network
parent091a364c802e34a58f3260c9cb5db9b75c62215c (diff)
sd-dhcp-lease/sd-network: modernization and fix leak
Diffstat (limited to 'src/network')
-rw-r--r--src/network/sd-network.c8
1 files changed, 3 insertions, 5 deletions
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);