summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-10-22 12:31:59 +0200
committerDan Winship <danw@gnome.org>2014-03-18 11:48:55 -0400
commitd6cbeac133ebb0ecf37143c7a9ee3999cf96ae97 (patch)
treebabc77565312956bcedc2dafa93023ad1b3e8bbe
parent778576f76107b62ce3456491e154df54888f601a (diff)
downloadNetworkManager-d6cbeac133ebb0ecf37143c7a9ee3999cf96ae97.tar.gz
dispatcher: fix memory leak in nm-dispatcher-action
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--callouts/nm-dispatcher-action.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c
index ed16a23991..083169fa10 100644
--- a/callouts/nm-dispatcher-action.c
+++ b/callouts/nm-dispatcher-action.c
@@ -134,9 +134,10 @@ request_free (Request *request)
g_free (request->action);
g_free (request->iface);
g_strfreev (request->envp);
- if (request->scripts)
+ if (request->scripts) {
g_ptr_array_foreach (request->scripts, (GFunc) script_info_free, NULL);
- g_ptr_array_free (request->scripts, TRUE);
+ g_ptr_array_free (request->scripts, TRUE);
+ }
}
static gboolean
@@ -172,7 +173,7 @@ next_script (gpointer user_data)
}
/* All done */
- results = g_ptr_array_sized_new (request->scripts->len);
+ results = g_ptr_array_new_full (request->scripts->len, (GDestroyNotify) g_value_array_free);
for (i = 0; i < request->scripts->len; i++) {
ScriptInfo *script = g_ptr_array_index (request->scripts, i);
GValue elt = {0, };
@@ -203,6 +204,7 @@ next_script (gpointer user_data)
dbus_g_method_return (request->context, results);
request_free (request);
+ g_ptr_array_unref (results);
return FALSE;
}