From b0e4827b9750edd358230890fdc671f378da9626 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Jan 2002 23:30:59 +0000 Subject: simple fix for creating blank data blobs (This used to be commit 08bb2dfec2ca0282e9268d09da2b966d3bdf493a) --- source3/lib/util.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 63939e0ecf..3409124fe2 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2098,17 +2098,22 @@ static void free_data_blob(DATA_BLOB *d) /******************************************************************* construct a data blob, must be freed with data_blob_free() + you can pass NULL for p and get a blank data blob *******************************************************************/ DATA_BLOB data_blob(const void *p, size_t length) { DATA_BLOB ret; - if (!p || !length) { + if (!length) { ZERO_STRUCT(ret); return ret; } - ret.data = smb_xmemdup(p, length); + if (p) { + ret.data = smb_xmemdup(p, length); + } else { + ret.data = smb_xmalloc(length); + } ret.length = length; ret.free = free_data_blob; return ret; -- cgit