[gnome-software/gnome-3-20] appstream: Fix icon loading for remote icons that have filename set



commit fb7bdb2575a3f167903d5ad677134019d08f9cb5
Author: Kalev Lember <klember redhat com>
Date:   Wed Jul 13 18:15:23 2016 +0200

    appstream: Fix icon loading for remote icons that have filename set
    
    This fixes the following valgrind warning:
    
    ==22489== Thread 6 pool:
    ==22489== Syscall param access(pathname) points to unaddressable byte(s)
    ==22489==    at 0x8E0B7A7: access (in /usr/lib64/libc-2.22.so)
    ==22489==    by 0x82DF366: g_file_test (gfileutils.c:409)
    ==22489==    by 0x1DF54212: gs_refine_item_pixbuf (gs-appstream.c:72)
    ==22489==    by 0x1DF54212: gs_appstream_refine_app (gs-appstream.c:582)
    ==22489==    by 0x1DF54CAE: gs_plugin_refine_from_pkgname (gs-plugin-appstream.c:311)
    ==22489==    by 0x1DF54CAE: gs_plugin_refine_app (gs-plugin-appstream.c:362)
    ==22489==    by 0x1506AE: gs_plugin_loader_run_refine (gs-plugin-loader.c:196)
    ==22489==    by 0x152B10: gs_plugin_loader_search_thread_cb (gs-plugin-loader.c:1491)
    ==22489==    by 0x7D5CD6C: g_task_thread_pool_thread (gtask.c:1287)
    ==22489==    by 0x831A27D: g_thread_pool_thread_proxy (gthreadpool.c:307)
    ==22489==    by 0x83198E4: g_thread_proxy (gthread.c:778)
    ==22489==    by 0x8B02619: start_thread (in /usr/lib64/libpthread-2.22.so)
    ==22489==    by 0x8E1B59C: clone (in /usr/lib64/libc-2.22.so)
    ==22489==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

 src/plugins/gs-appstream.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 7672c38..2d0b0a5 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -63,7 +63,8 @@ gs_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);
-               if (as_icon_get_filename (icon) == NULL) {
+               fn = g_strdup (as_icon_get_filename (icon));
+               if (fn == NULL) {
                        cachedir = gs_utils_get_cachedir ("icons", NULL);
                        fn = g_build_filename (cachedir, as_icon_get_name (icon), NULL);
                        as_icon_set_filename (icon, fn);


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