diff options
Diffstat (limited to 'source4/lib/registry')
-rw-r--r-- | source4/lib/registry/common/reg_objects.c | 27 | ||||
-rw-r--r-- | source4/lib/registry/tools/gregedit.c | 12 |
2 files changed, 8 insertions, 31 deletions
diff --git a/source4/lib/registry/common/reg_objects.c b/source4/lib/registry/common/reg_objects.c index 809829b3e8..78260e198f 100644 --- a/source4/lib/registry/common/reg_objects.c +++ b/source4/lib/registry/common/reg_objects.c @@ -34,31 +34,8 @@ REG_VAL* reg_val_dup( REG_VAL *val ) { - REG_VAL *copy = NULL; - TALLOC_CTX *new_mem_ctx = talloc_init(val->name); - - if ( !val ) - return NULL; - - if ( !(copy = talloc( new_mem_ctx, sizeof(REG_VAL) )) ) { - DEBUG(0,("dup_registry_value: malloc() failed!\n")); - return NULL; - } - - /* copy all the non-pointer initial data */ - - memcpy( copy, val, sizeof(REG_VAL) ); - if ( val->data_blk ) - { - if ( !(copy->data_blk = talloc_memdup( new_mem_ctx, val->data_blk, val->data_len )) ) { - DEBUG(0,("dup_registry_value: memdup() failed for [%d] bytes!\n", - val->data_len)); - SAFE_FREE( copy ); - } - } - copy->mem_ctx = new_mem_ctx; - - return copy; + val->ref++; + return val; } /********************************************************************** diff --git a/source4/lib/registry/tools/gregedit.c b/source4/lib/registry/tools/gregedit.c index 4fbb1b2705..0c9084ad3e 100644 --- a/source4/lib/registry/tools/gregedit.c +++ b/source4/lib/registry/tools/gregedit.c @@ -65,19 +65,20 @@ static void gtk_show_werror(WERROR err) static void expand_key(GtkTreeView *treeview, GtkTreeIter *parent, GtkTreePath *arg2) { - GtkTreeIter iter, tmpiter; + GtkTreeIter firstiter, iter, tmpiter; REG_KEY *k, *sub; char *name; GValue value; WERROR error; int i; + gtk_tree_model_iter_children(GTK_TREE_MODEL(store_keys), &firstiter, parent); + /* See if this row has ever had a name gtk_tree_store_set()'ed to it. If not, read the directory contents */ - gtk_tree_model_get(GTK_TREE_MODEL(store_keys), parent, - 0, &name, -1); + gtk_tree_model_get(GTK_TREE_MODEL(store_keys), &firstiter, 0, &name, -1); - if(!name) return; + if(name) return; gtk_tree_model_get(GTK_TREE_MODEL(store_keys), parent, 1, &k, -1); @@ -91,8 +92,7 @@ static void expand_key(GtkTreeView *treeview, GtkTreeIter *parent, GtkTreePath * node GTK gets confused and won't expand the parent row. */ if(i == 0) { - gtk_tree_model_iter_children(GTK_TREE_MODEL(store_keys), - &iter, parent); + iter = firstiter; } else { gtk_tree_store_append(store_keys, &iter, parent); } |