[glib] registrybackend: avoid adding a new child when we return the root
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] registrybackend: avoid adding a new child when we return the root
- Date: Fri, 5 Feb 2016 11:10:19 +0000 (UTC)
commit 19fd89f8db75928038929f9ea6d918c5f5deb1a5
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Fri Feb 5 12:05:02 2016 +0100
registrybackend: avoid adding a new child when we return the root
gio/gregistrysettingsbackend.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c
index 357b5de..de810dd 100644
--- a/gio/gregistrysettingsbackend.c
+++ b/gio/gregistrysettingsbackend.c
@@ -627,6 +627,13 @@ registry_cache_get_node_for_key (GNode *root,
/* Ignore preceding / */
component = g_strdup (key_name);
c = strchr (component, '/');
+
+ if (c == NULL)
+ {
+ g_free (component);
+ return root;
+ }
+
if (c != NULL)
*c = 0;
@@ -642,9 +649,7 @@ registry_cache_get_node_for_key (GNode *root,
trace ("get_node_for_key: New node for component '%s'\n", component);
}
- if (c == NULL)
- result = root;
- else if (*(c + 1) == 0)
+ if (*(c + 1) == 0)
result = child;
else if (child != NULL)
result = registry_cache_get_node_for_key_recursive (child, c + 1,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]