dispatcher: use slice allocator for Request and ScriptInfo
authorThomas Haller <thaller@redhat.com>
Mon, 3 Aug 2015 14:15:25 +0000 (16:15 +0200)
committerBeniamino Galvani <bgalvani@redhat.com>
Tue, 25 Aug 2015 13:27:18 +0000 (15:27 +0200)
callouts/nm-dispatcher.c

index 0999b19..98f6186 100644 (file)
@@ -140,7 +140,7 @@ script_info_free (gpointer ptr)
 
        g_free (info->script);
        g_free (info->error);
-       g_free (info);
+       g_slice_free (ScriptInfo, info);
 }
 
 static void
@@ -155,7 +155,7 @@ request_free (Request *request)
        if (request->scripts)
                g_ptr_array_free (request->scripts, TRUE);
 
-       g_free (request);
+       g_slice_free (Request, request);
 }
 
 static gboolean
@@ -637,7 +637,7 @@ handle_action (NMDBusDispatcher *dbus_dispatcher,
 
        nm_clear_g_source (&quit_id);
 
-       request = g_malloc0 (sizeof (*request));
+       request = g_slice_new0 (Request);
        request->handler = h;
        request->debug = request_debug || debug;
        request->context = context;
@@ -668,7 +668,9 @@ handle_action (NMDBusDispatcher *dbus_dispatcher,
 
        request->scripts = g_ptr_array_new_full (5, script_info_free);
        for (iter = sorted_scripts; iter; iter = g_slist_next (iter)) {
-               ScriptInfo *s = g_malloc0 (sizeof (*s));
+               ScriptInfo *s;
+
+               s = g_slice_new0 (ScriptInfo);
                s->request = request;
                s->script = iter->data;
                s->wait = script_must_wait (s->script);