summaryrefslogtreecommitdiff
path: root/source4/lib/registry/common
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/registry/common')
-rw-r--r--source4/lib/registry/common/reg_objects.c3
-rw-r--r--source4/lib/registry/common/reg_util.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/source4/lib/registry/common/reg_objects.c b/source4/lib/registry/common/reg_objects.c
index 78260e198f..3f721c107e 100644
--- a/source4/lib/registry/common/reg_objects.c
+++ b/source4/lib/registry/common/reg_objects.c
@@ -47,6 +47,9 @@ void reg_val_free( REG_VAL *val )
if ( !val )
return;
+ val->ref--;
+ if(val->ref) return;
+
if(val->handle->functions->free_val_backend_data)
val->handle->functions->free_val_backend_data(val);
diff --git a/source4/lib/registry/common/reg_util.c b/source4/lib/registry/common/reg_util.c
index 5ca104fc2e..82b8d06679 100644
--- a/source4/lib/registry/common/reg_util.c
+++ b/source4/lib/registry/common/reg_util.c
@@ -45,10 +45,10 @@ char *reg_val_data_string(REG_VAL *v)
switch (reg_val_type(v)) {
case REG_SZ:
/* FIXME: Convert to ascii */
- return strdup(reg_val_data_blk(v));
+ return strndup(reg_val_data_blk(v), reg_val_size(v));
case REG_EXPAND_SZ:
- return strdup(reg_val_data_blk(v));
+ return strndup(reg_val_data_blk(v), reg_val_size(v));
case REG_BINARY:
ret = malloc(reg_val_size(v) * 3 + 2);