summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_objects.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index 42bdb8f482..fba98b3fb1 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -310,8 +310,16 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, const char *name, uint16 type,
fstrcpy( ctr->values[ctr->num_values]->valuename, name );
ctr->values[ctr->num_values]->type = type;
- ctr->values[ctr->num_values]->data_p = (uint8 *)TALLOC_MEMDUP(
- ctr, data_p, size );
+ if (size) {
+ ctr->values[ctr->num_values]->data_p = (uint8 *)TALLOC_MEMDUP(
+ ctr, data_p, size );
+ if (!ctr->values[ctr->num_values]->data_p) {
+ ctr->num_values = 0;
+ return 0;
+ }
+ } else {
+ ctr->values[ctr->num_values]->data_p = NULL;
+ }
ctr->values[ctr->num_values]->size = size;
ctr->num_values++;
@@ -350,8 +358,16 @@ int regval_ctr_copyvalue( REGVAL_CTR *ctr, REGISTRY_VALUE *val )
fstrcpy( ctr->values[ctr->num_values]->valuename, val->valuename );
ctr->values[ctr->num_values]->type = val->type;
- ctr->values[ctr->num_values]->data_p = (uint8 *)TALLOC_MEMDUP(
- ctr, val->data_p, val->size );
+ if (val->size) {
+ ctr->values[ctr->num_values]->data_p = (uint8 *)TALLOC_MEMDUP(
+ ctr, val->data_p, val->size );
+ if (!ctr->values[ctr->num_values]->data_p) {
+ ctr->num_values = 0;
+ return 0;
+ }
+ } else {
+ ctr->values[ctr->num_values]->data_p = NULL;
+ }
ctr->values[ctr->num_values]->size = val->size;
ctr->num_values++;
}