summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-01-15 14:11:26 +0100
committerThomas Haller <thaller@redhat.com>2015-02-03 13:01:53 +0100
commit643f042b9b181655fda6989ecf297b65c615f66c (patch)
treefbe55ef089f51505cd5546565af59b09f7d42058
parent86ac1ad7bd185e7d8838676bde74458719833ca2 (diff)
downloadNetworkManager-643f042b9b181655fda6989ecf297b65c615f66c.tar.gz
config: fix memory leak in merge_no_auto_default_state()
-rw-r--r--src/nm-config.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nm-config.c b/src/nm-config.c
index fa9a894429..d3da01ba56 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -276,13 +276,17 @@ merge_no_auto_default_state (NMConfig *config)
list = g_strsplit (data, "\n", -1);
for (i = 0; list[i]; i++) {
if (!*list[i])
- continue;
- for (j = 0; j < updated->len; j++) {
- if (!strcmp (list[i], updated->pdata[j]))
- break;
+ g_free (list[i]);
+ else {
+ for (j = 0; j < updated->len; j++) {
+ if (!strcmp (list[i], updated->pdata[j]))
+ break;
+ }
+ if (j == updated->len)
+ g_ptr_array_add (updated, list[i]);
+ else
+ g_free (list[i]);
}
- if (j == updated->len)
- g_ptr_array_add (updated, list[i]);
}
g_free (list);
g_free (data);