[gnome-software: 16/18] appstream: Fix some icon leaks in gs-appstream.c




commit 296fb0543cd2d69944a49114eac2bfa56410a1e3
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Mar 9 13:02:59 2021 +0000

    appstream: Fix some icon leaks in gs-appstream.c
    
    These were accidentally introduced in commit f2a7c88bef.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/core/gs-appstream.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index 433b0a22e..a9cf97270 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -214,6 +214,7 @@ gs_appstream_refine_icon (GsPlugin *plugin, GsApp *app, XbNode *component)
                 * to style all apps in the software center). Since we can not rely on the icon's presence,
                 * we also add other icons to the list and do not return here. */
                app_add_icon (app, icon);
+               g_clear_object (&icon);
        }
 
        /* cached icon for large uses */
@@ -222,6 +223,7 @@ gs_appstream_refine_icon (GsPlugin *plugin, GsApp *app, XbNode *component)
                                                       128 * gs_plugin_get_scale (plugin));
        if (icon != NULL) {
                app_add_icon (app, icon);
+               g_clear_object (&icon);
        }
 
        /* cached icon for normal uses */
@@ -230,6 +232,7 @@ gs_appstream_refine_icon (GsPlugin *plugin, GsApp *app, XbNode *component)
                                                       64 * gs_plugin_get_scale (plugin));
        if (icon != NULL) {
                app_add_icon (app, icon);
+               g_clear_object (&icon);
        }
 
        /* prefer local */
@@ -258,6 +261,7 @@ gs_appstream_refine_icon (GsPlugin *plugin, GsApp *app, XbNode *component)
        if (n != NULL) {
                icon = gs_appstream_new_icon (component, n, AS_ICON_KIND_STOCK, 0);
                app_add_icon (app, icon);
+               g_clear_object (&icon);
        }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]