summaryrefslogtreecommitdiff
path: root/source4/lib/data_blob.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/data_blob.c')
-rw-r--r--source4/lib/data_blob.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/data_blob.c b/source4/lib/data_blob.c
index e10ebfe606..c8c57849d2 100644
--- a/source4/lib/data_blob.c
+++ b/source4/lib/data_blob.c
@@ -56,6 +56,11 @@ DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length)
if (ret.data) {
ret.data = talloc_steal(mem_ctx, ret.data);
+ } else {
+ /* this ensures the blob has the context attached, so a zero length call
+ to data_blob_talloc followed by a realloc doesn't cause the memory to come
+ from the NULL context */
+ ret.data = talloc(mem_ctx, 0);
}
return ret;
}