[gnome-software/gnome-3-18] Use gs_plugin_add_app(), avoid dangling pointer
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-18] Use gs_plugin_add_app(), avoid dangling pointer
- Date: Tue, 6 Oct 2015 11:22:38 +0000 (UTC)
commit 69defb21e0236bcecfe0870e3e2b2d9fd266ddcf
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 5e910d9..f43a74f 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2312,7 +2312,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
GPtrArray *addons;
gboolean ret;
guint i;
- g_autoptr(GList) list = NULL;
+ g_autoptr(GsAppList) list = NULL;
/* add to list */
g_mutex_lock (&priv->pending_apps_mutex);
@@ -2340,7 +2340,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]