summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-10-10 09:52:39 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-10-10 09:52:39 +0200
commit31ad3dbc966ccbad7e26079561f13a587b44ebae (patch)
treeacbaf677602c55129c89ddaacba1934ced25b2a6
parente037c66b6a14d4465cd0f2219bfe5320e72ef743 (diff)
downloadNetworkManager-31ad3dbc966ccbad7e26079561f13a587b44ebae.tar.gz
core: fix memory leaks in NMIP{4,6}Config
Fixes: 03e1cc96a5dc3d9a9b86f60810a330332c484a94 Fixes: 9a3117f1d3095e58859efce57ea4fb41d8fb7696
-rw-r--r--src/nm-ip4-config.c2
-rw-r--r--src/nm-ip6-config.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 63eb3a71ff..657ea6346b 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -713,7 +713,7 @@ nm_ip4_config_add_dependent_routes (NMIP4Config *self,
NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID)) {
/* we already track this route. Don't add it again. */
} else
- _add_route (self, nmp_object_ref (r), NULL, NULL);
+ _add_route (self, r, NULL, NULL);
if ( out_ip4_dev_route_blacklist
&& ( route_table != RT_TABLE_MAIN
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 81b443c67e..8eeabca223 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -460,7 +460,6 @@ nm_ip6_config_add_dependent_routes (NMIP6Config *self,
* For manually added IPv6 routes, add the device routes explicitly. */
nm_ip_config_iter_ip6_address_for_each (&iter, self, &my_addr) {
- NMPObject *r;
NMPlatformIP6Route *route;
gboolean has_peer;
int routes_n, routes_i;
@@ -477,6 +476,7 @@ nm_ip6_config_add_dependent_routes (NMIP6Config *self,
? 2 : 1;
for (routes_i = 0; routes_i < routes_n; routes_i++) {
+ nm_auto_nmpobj NMPObject *r = NULL;
r = nmp_object_new (NMP_OBJECT_TYPE_IP6_ROUTE, NULL);
route = NMP_OBJECT_CAST_IP6_ROUTE (r);
@@ -503,7 +503,6 @@ nm_ip6_config_add_dependent_routes (NMIP6Config *self,
r,
NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID)) {
/* we already track this route. Don't add it again. */
- nmp_object_unref (r);
} else
_add_route (self, r, NULL, NULL);
}