summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-13 20:03:03 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-14 18:46:21 +0100
commitf72790daaa6ecef922edcfba38effdc8e5885782 (patch)
tree55129d12502fb7c7ced8f07117e4c0b6eccb9bec /source4
parent33eb1c95e55bb26aee7ee3876e38136eb56ef36e (diff)
downloadsamba-f72790daaa6ecef922edcfba38effdc8e5885782.tar.gz
samba-f72790daaa6ecef922edcfba38effdc8e5885782.tar.bz2
samba-f72790daaa6ecef922edcfba38effdc8e5885782.zip
s4:registry - ldb.c - fix up the memory handling in "reg_ldb_unpack_value"
Don't substitute existing data blobs with new ones and make sure, that the result objects in the data blob don't have memory dependencies of the LDB value input.
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/ldb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index e168d8fd02..71824e7732 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -73,8 +73,11 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
case REG_DWORD:
if (val != NULL) {
uint32_t tmp = strtoul((char *)val->data, NULL, 0);
- *data = data_blob_talloc(mem_ctx, NULL, 4);
- SIVAL(data->data, 0, tmp);
+ data->data = talloc_size(mem_ctx, sizeof(uint32_t) + 1);
+ if (data->data != NULL) {
+ SIVAL(data->data, 0, tmp);
+ }
+ data->length = sizeof(uint32_t);
} else {
data->data = NULL;
data->length = 0;
@@ -84,7 +87,9 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
case REG_BINARY:
default:
if (val != NULL) {
- *data = data_blob_talloc(mem_ctx, val->data, val->length);
+ data->data = talloc_memdup(mem_ctx, val->data,
+ val->length);
+ data->length = val->length;
} else {
data->data = NULL;
data->length = 0;