summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-30 01:34:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:48 -0500
commit79de0ad9463a5cd64978beae37df79fbb4f74632 (patch)
treefeb1638b81ac49909465456163e70cf4e57dc3a9 /source3/registry
parent1e362c0e7fff603cffa32863a5b07ecbc50f8a2d (diff)
downloadsamba-79de0ad9463a5cd64978beae37df79fbb4f74632.tar.gz
samba-79de0ad9463a5cd64978beae37df79fbb4f74632.tar.bz2
samba-79de0ad9463a5cd64978beae37df79fbb4f74632.zip
r22588: Make all uses of TALLOC_MEMDUP consistent.
Jeremy. (This used to be commit 8ad13718af0ba1fcb10a6f1631b1ed3cb8d11175)
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++;
}