[gedit-plugins] zeitgeist: fix use-after-free of a GPtrArray



commit 741952f0986d5c1bdf8a11f06144010613fe34d2
Author: Steve Dodier-Lazaro <sidnioulz gmail com>
Date:   Fri Jul 31 07:50:34 2015 +0100

    zeitgeist: fix use-after-free of a GPtrArray
    
    The Zeitgeist plugin creates a GPtrArray to give to libzeitgeist when
    registering a Zeitgeist datasource. libzeitgeist internally sinks this
    reference, but the plugin assumes the GPtrArray to still be available
    and later attempts to unref it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752824

 plugins/zeitgeist/gedit-zeitgeist-plugin.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/plugins/zeitgeist/gedit-zeitgeist-plugin.c b/plugins/zeitgeist/gedit-zeitgeist-plugin.c
index 738f1d5..65f472f 100644
--- a/plugins/zeitgeist/gedit-zeitgeist-plugin.c
+++ b/plugins/zeitgeist/gedit-zeitgeist-plugin.c
@@ -278,6 +278,7 @@ gedit_zeitgeist_plugin_app_activate (GeditAppActivatable *activatable)
                                          "application://org.gnome.gedit.desktop", NULL, NULL);
        ptr_arr = g_ptr_array_new ();
        g_ptr_array_add (ptr_arr, event);
+       g_ptr_array_ref (ptr_arr);
 
        ds = zeitgeist_data_source_new_full ("org.gnome.gedit,dataprovider",
                                             "Gedit dataprovider",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]