mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
simple fix for creating blank data blobs
(This used to be commit 08bb2dfec2
)
This commit is contained in:
parent
ca0ccee23f
commit
b0e4827b97
@ -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;
|
||||
|
@ -486,9 +486,7 @@ BOOL msrpc_gen(DATA_BLOB *blob,
|
||||
va_end(ap);
|
||||
|
||||
/* allocate the space, then scan the format again to fill in the values */
|
||||
blob->data = malloc(head_size + data_size);
|
||||
blob->length = head_size + data_size;
|
||||
if (!blob->data) return False;
|
||||
*blob = data_blob(NULL, head_size + data_size);
|
||||
|
||||
head_ofs = 0;
|
||||
data_ofs = head_size;
|
||||
|
Loading…
Reference in New Issue
Block a user