[gnome-settings-daemon] gconf: Double check stuff we add to the hash table



commit eb29762836f72096a78cb7f0bc98322fae22d9fc
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Fri Sep 2 16:15:38 2011 +0200

    gconf: Double check stuff we add to the hash table
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658055

 plugins/gconf/gsd-gconf-manager.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/plugins/gconf/gsd-gconf-manager.c b/plugins/gconf/gsd-gconf-manager.c
index f5c87ab..7723e35 100644
--- a/plugins/gconf/gsd-gconf-manager.c
+++ b/plugins/gconf/gsd-gconf-manager.c
@@ -108,6 +108,9 @@ gsd_gconf_manager_start (GsdGconfManager *manager, GError **error)
                                 gsize key_len, j;
                                 GHashTable *keys_hash = NULL;
 
+                                if (!groups[i])
+                                        continue;
+
                                 keys = g_key_file_get_keys (key_file, groups[i], &key_len, error);
                                 for (j = 0; j < key_len; j++) {
                                         if (keys_hash == NULL)
@@ -120,9 +123,15 @@ gsd_gconf_manager_start (GsdGconfManager *manager, GError **error)
                                 g_strfreev (keys);
 
                                 if (keys_hash != NULL) {
-                                        g_hash_table_insert (manager->priv->conf_watchers,
-                                                             g_strdup (groups[i]),
-                                                             conf_watcher_new (groups[i], keys_hash));
+                                        ConfWatcher *watcher;
+
+                                        watcher = conf_watcher_new (groups[i], keys_hash);
+                                        if (watcher) {
+                                                g_hash_table_insert (manager->priv->conf_watchers,
+                                                                     g_strdup (groups[i]),
+                                                                     watcher);
+                                        } else
+                                                g_hash_table_destroy (keys_hash);
                                 }
                         }
 



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