core: fix leaks for nm_setting_ip[46]_config_add_\(route\|address\)()

Error found by coverity.

https://bugzilla.gnome.org/show_bug.cgi?id=728320

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-04-15 19:19:08 +02:00
parent f19e79cd7a
commit 73d4edb0b7
2 changed files with 5 additions and 1 deletions

View file

@ -540,7 +540,7 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set
/* Routes */
for (i = 0; i < nroutes; i++) {
const NMPlatformIP6Route *route = nm_ip6_config_get_route (config, i);
NMIP6Route *s_route = nm_ip6_route_new ();
NMIP6Route *s_route;
/* Ignore link-local route. */
if (IN6_IS_ADDR_LINKLOCAL (&route->network))
@ -550,6 +550,7 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set
if (!route->plen)
continue;
s_route = nm_ip6_route_new ();
nm_ip6_route_set_dest (s_route, &route->network);
nm_ip6_route_set_prefix (s_route, route->plen);
if (!IN6_IS_ADDR_UNSPECIFIED (&route->network))
@ -557,6 +558,7 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set
nm_ip6_route_set_metric (s_route, route->metric);
nm_setting_ip6_config_add_route (setting, s_route);
nm_ip6_route_unref (s_route);
}
/* DNS */

View file

@ -527,6 +527,7 @@ update_ip4_setting_from_if_block(NMConnection *connection,
} else {
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP4 address");
}
nm_ip4_address_unref (addr);
nameserver_v = ifparser_getkey (block, "dns-nameserver");
ifupdown_ip4_add_dns (s_ip4, nameserver_v);
@ -647,6 +648,7 @@ update_ip6_setting_from_if_block(NMConnection *connection,
} else {
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP6 address");
}
nm_ip6_address_unref (addr);
nameserver_v = ifparser_getkey(block, "dns-nameserver");
ifupdown_ip6_add_dns (s_ip6, nameserver_v);