summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-04-15 19:19:08 +0200
committerThomas Haller <thaller@redhat.com>2014-04-24 21:18:08 +0200
commit73d4edb0b788f6534ef1d818492a1c06477ce044 (patch)
treedb4c97039bccc7d027132eab3d96af41e424779c
parentf19e79cd7a739a20940597c1e373083e8837f411 (diff)
downloadNetworkManager-73d4edb0b788f6534ef1d818492a1c06477ce044.tar.gz
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>
-rw-r--r--src/nm-ip6-config.c4
-rw-r--r--src/settings/plugins/ifupdown/parser.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 36f5e72fdc..0a7cf26a3b 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -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 */
diff --git a/src/settings/plugins/ifupdown/parser.c b/src/settings/plugins/ifupdown/parser.c
index 2b273bc3a2..91ed3e21ba 100644
--- a/src/settings/plugins/ifupdown/parser.c
+++ b/src/settings/plugins/ifupdown/parser.c
@@ -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);