diff options
Diffstat (limited to 'source3/lib/data_blob.c')
-rw-r--r-- | source3/lib/data_blob.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c index 4056212fc5..83afc591a1 100644 --- a/source3/lib/data_blob.c +++ b/source3/lib/data_blob.c @@ -61,14 +61,20 @@ DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length) { DATA_BLOB ret; - if (!p || !length) { + if (!length) { ZERO_STRUCT(ret); return ret; } - ret.data = talloc_memdup(mem_ctx, p, length); - if (ret.data == NULL) - smb_panic("data_blob_talloc: talloc_memdup failed.\n"); + if (p) { + ret.data = talloc_memdup(mem_ctx, p, length); + if (ret.data == NULL) + smb_panic("data_blob_talloc: talloc_memdup failed.\n"); + } else { + ret.data = talloc(mem_ctx, length); + if (ret.data == NULL) + smb_panic("data_blob_talloc: talloc failed.\n"); + } ret.length = length; ret.free = NULL; |