gnome-software/0001-Use-gs_plugin_add_app-avoid-dangling-pointer.patch
2015-10-07 14:58:06 +02:00

43 lines
1.5 KiB
Diff

From 69defb21e0236bcecfe0870e3e2b2d9fd266ddcf Mon Sep 17 00:00:00 2001
From: Rafal Luzynski <digitalfreak@lingonborough.com>
Date: Sun, 27 Sep 2015 01:57:50 +0200
Subject: [PATCH] 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 file 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,
--
2.5.0