[gnome-software] Only set the remote icon filename once



commit 96a4f81bd245a0fcbbca4e54f7324bf1cb6a98af
Author: Richard Hughes <richard hughsie com>
Date:   Mon May 11 16:10:42 2015 +0100

    Only set the remote icon filename once
    
    We can hit a use-after-free where libsoup is using the old local filename.

 src/plugins/gs-plugin-appstream.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 2a006f4..4deba19 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -264,13 +264,15 @@ gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AsApp *item)
        switch (as_icon_get_kind (icon)) {
        case AS_ICON_KIND_REMOTE:
                gs_app_set_icon (app, icon);
-               path = g_build_filename (g_get_user_data_dir (),
-                                        "gnome-software",
-                                        "icons",
-                                        NULL);
-               fn = g_build_filename (path, as_icon_get_name (icon), NULL);
-               as_icon_set_filename (icon, fn);
-               as_icon_set_prefix (icon, path);
+               if (as_icon_get_filename (icon) == NULL) {
+                       path = g_build_filename (g_get_user_data_dir (),
+                                                "gnome-software",
+                                                "icons",
+                                                NULL);
+                       fn = g_build_filename (path, as_icon_get_name (icon), NULL);
+                       as_icon_set_filename (icon, fn);
+                       as_icon_set_prefix (icon, path);
+               }
                if (g_file_test (fn, G_FILE_TEST_EXISTS)) {
                        as_icon_set_kind (icon, AS_ICON_KIND_LOCAL);
                        ret = gs_app_load_icon (app, plugin->scale, &error);


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