r169: Fix gregedit
[kai/samba.git] / source / lib / registry / common / reg_objects.c
index 809829b3e8fa17ced3d15db694c8e9b21573270f..78260e198fd45aa1d2d471488b8b9431f36f4832 100644 (file)
 
 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;     
 }
 
 /**********************************************************************