[gnome-software/gnome-3-16] Use gs_plugin_add_app(), avoid dangling pointer
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-16] Use gs_plugin_add_app(), avoid dangling pointer
- Date: Sun, 11 Oct 2015 12:07:37 +0000 (UTC)
commit e2f6a880e7396f9f82e099d6021d3a18e8e8a2e5
Author: Rafal Luzynski <digitalfreak lingonborough com>
Date: Sun Sep 27 01:57:50 2015 +0200
Use gs_plugin_add_app(), avoid dangling pointer
The gs_plugin_loader_run_refine() function assumes that the list
holds a reference to each of its apps and it unrefs each app when
removing. This causes a dangling pointer and severe memory corruption
issues if a reference is not held. gs_plugin_add_app() is a helper
which ensures a correct reference management and it has been used
correctly everywhere except install, remove and rating action.
https://bugzilla.gnome.org/show_bug.cgi?id=755664
src/gs-plugin-loader.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 28b501b..33a12c6 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2455,7 +2455,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
GPtrArray *addons;
gboolean ret;
guint i;
- _cleanup_list_free_ GList *list = NULL;
+ _cleanup_plugin_list_free_ GList *list = NULL;
/* add to list */
g_mutex_lock (&plugin_loader->priv->pending_apps_mutex);
@@ -2483,7 +2483,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
}
/* refine again to make sure we pick up new source id */
- list = g_list_prepend (list, state->app);
+ gs_plugin_add_app (&list, state->app);
ret = gs_plugin_loader_run_refine (plugin_loader,
state->function_name,
&list,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]