core: fix memory leaks in NMIP{4,6}Config

Fixes: 03e1cc96a5
Fixes: 9a3117f1d3
This commit is contained in:
Beniamino Galvani 2017-10-10 09:52:39 +02:00
parent e037c66b6a
commit 31ad3dbc96
2 changed files with 2 additions and 3 deletions

View file

@ -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

View file

@ -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);
}