summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c1
-rw-r--r--src/network/sd-network.c8
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);