[gnome-software/gnome-3-22] Fix use of freed memory.



commit de57116160e09ac250d04d972fbbf367da663c15
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Oct 5 12:14:23 2016 +1300

    Fix use of freed memory.
    
    The change in 1350bcf fixed the containers (and possibly some of the contents)
    being leaked, but didn't then copy the contents into their new containers.
    
    Noted by @sourcejedi on github.com.

 src/gs-folders.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-folders.c b/src/gs-folders.c
index 0b7b7cb..7c6f6ca 100644
--- a/src/gs-folders.c
+++ b/src/gs-folders.c
@@ -199,18 +199,18 @@ load (GsFolders *folders)
 
                excluded_apps = g_settings_get_strv (settings, "excluded-apps");
                for (j = 0; excluded_apps[j]; j++) {
-                       g_hash_table_add (folder->excluded_apps, excluded_apps[j]);
+                       g_hash_table_add (folder->excluded_apps, g_strdup (excluded_apps[j]));
                }
 
                apps = g_settings_get_strv (settings, "apps");
                for (j = 0; apps[j]; j++) {
                        if (!g_hash_table_contains (folder->excluded_apps, apps[j]))
-                               g_hash_table_add (folder->apps, apps[j]);
+                               g_hash_table_add (folder->apps, g_strdup (apps[j]));
                }
 
                categories = g_settings_get_strv (settings, "categories");
                for (j = 0; categories[j]; j++) {
-                       g_hash_table_add (folder->categories, categories[j]);
+                       g_hash_table_add (folder->categories, g_strdup (categories[j]));
                }
 
                g_hash_table_insert (folders->folders, (gpointer)folder->id, folder);


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