[gnome-software] shell-extensions: Fix a potentially sizable memory leak
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] shell-extensions: Fix a potentially sizable memory leak
- Date: Thu, 19 Oct 2017 17:22:36 +0000 (UTC)
commit 26c0507b8ed790a99dcdd7a239296bed0b3eb618
Author: Richard Hughes <richard hughsie com>
Date: Thu Oct 19 17:18:28 2017 +0100
shell-extensions: Fix a potentially sizable memory leak
This only happens when the shell extension has an invalid icon, or the shell
version map is invalid or missing.
.../shell-extensions/gs-plugin-shell-extensions.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/plugins/shell-extensions/gs-plugin-shell-extensions.c
b/plugins/shell-extensions/gs-plugin-shell-extensions.c
index 3327268..beb1fdb 100644
--- a/plugins/shell-extensions/gs-plugin-shell-extensions.c
+++ b/plugins/shell-extensions/gs-plugin-shell-extensions.c
@@ -263,6 +263,7 @@ gboolean
gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
+ g_autofree gchar *name_owner = NULL;
g_autoptr(GVariant) version = NULL;
if (priv->proxy != NULL)
@@ -281,7 +282,8 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
}
/* not running under Shell */
- if (g_dbus_proxy_get_name_owner (priv->proxy) == NULL) {
+ name_owner = g_dbus_proxy_get_name_owner (priv->proxy);
+ if (name_owner == NULL) {
g_clear_object (&priv->proxy);
return FALSE;
}
@@ -456,7 +458,7 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
JsonObject *json_app,
GError **error)
{
- AsApp *app;
+ g_autoptr(AsApp) app = NULL;
JsonObject *json_ver_map;
const gchar *tmp;
@@ -536,7 +538,7 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
as_app_add_metadata (app, "GnomeSoftware::OriginHostnameUrl",
SHELL_EXTENSIONS_API_URI);
- return app;
+ return g_steal_pointer (&app);
}
static GPtrArray *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]