[gnome-software] Fix a potentially invalid read spotted by valgrind



commit 05fba6ae2a50ad4037b304d2181f62588fc52424
Author: Richard Hughes <richard hughsie com>
Date:   Fri Nov 29 14:39:35 2013 +0000

    Fix a potentially invalid read spotted by valgrind

 src/plugins/appstream-cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/appstream-cache.c b/src/plugins/appstream-cache.c
index d51eb7f..8b08b27 100644
--- a/src/plugins/appstream-cache.c
+++ b/src/plugins/appstream-cache.c
@@ -493,7 +493,7 @@ appstream_cache_add_item (AppstreamCacheHelper *helper)
        for (i = 0; i < pkgnames->len; i++) {
                pkgname = g_ptr_array_index (pkgnames, i);
                g_hash_table_insert (priv->hash_pkgname,
-                                    (gpointer) pkgname,
+                                    g_strdup (pkgname),
                                     helper->item_temp);
        }
 }
@@ -916,7 +916,7 @@ appstream_cache_init (AppstreamCache *cache)
                                               NULL);
        priv->hash_pkgname = g_hash_table_new_full (g_str_hash,
                                                    g_str_equal,
-                                                   NULL,
+                                                   g_free,
                                                    NULL);
 }
 


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