summary refs log tree commit diff
path: root/src/dhcp-manager/nm-dhcp-systemd.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-11-24 00:06:32 +0100
committerMichael Biebl <biebl@debian.org>2015-11-24 00:06:32 +0100
commita6ece1a2aa19a6268335c87d4fdef20123dd04a5 (patch)
tree87f1961faacdfafb1c4fee5f2feb6bcb5c06813b /src/dhcp-manager/nm-dhcp-systemd.c
parent81836c2d44802b4cca833d7775dd627e0797a7e2 (diff)
Imported Upstream version 1.0.8 upstream/1.0.8
Diffstat (limited to 'src/dhcp-manager/nm-dhcp-systemd.c')
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c
index 2bd0d72f..571765f7 100644
--- a/src/dhcp-manager/nm-dhcp-systemd.c
+++ b/src/dhcp-manager/nm-dhcp-systemd.c
@@ -397,6 +397,7 @@ nm_dhcp_systemd_get_lease_ip_configs (const char *iface,
 		ip4_config = lease_to_ip4_config (lease, NULL, default_route_metric, FALSE, NULL);
 		if (ip4_config)
 			leases = g_slist_append (leases, ip4_config);
+		sd_dhcp_lease_unref (lease);
 	}
 
 	return leases;
@@ -532,6 +533,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 	struct in_addr last_addr = { 0 };
 	const char *hostname;
 	int r, i;
+	gboolean success = FALSE;
 
 	g_assert (priv->client4 == NULL);
 	g_assert (priv->client6 == NULL);
@@ -618,8 +620,6 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 		}
 	}
 
-	if (lease)
-		sd_dhcp_lease_unref (lease);
 
 	/* Add requested options */
 	for (i = 0; dhcp4_requests[i].name; i++) {
@@ -642,12 +642,13 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 		goto error;
 	}
 
-	return TRUE;
+	success = TRUE;
 
 error:
-	sd_dhcp_client_unref (priv->client4);
-	priv->client4 = NULL;
-	return FALSE;
+	sd_dhcp_lease_unref (lease);
+	if (!success)
+		priv->client4 = sd_dhcp_client_unref (priv->client4);
+	return success;
 }
 
 static void