[gnome-software] Use gs_plugin_add_app(), avoid dangling pointer
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Use gs_plugin_add_app(), avoid dangling pointer
- Date: Mon, 28 Sep 2015 08:37:21 +0000 (UTC)
commit 0235b75df5124cb9162a0332fc0c7f83bcd4715e
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 f463e52..6c32321 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2244,7 +2244,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);
@@ -2272,7 +2272,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]