mirror of
https://github.com/samba-team/samba.git
synced 2025-12-06 16:23:49 +03:00
r1435: talloc_steal is very useful - add a function to do it with a DATA_BLOB
Andrew Bartlett
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
e8de8905b2
commit
66d6e26110
@@ -99,6 +99,21 @@ DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length)
|
|||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Steal a talloc'ed DATA_BLOB from one context to another
|
||||||
|
*/
|
||||||
|
|
||||||
|
DATA_BLOB data_blob_talloc_steal(TALLOC_CTX *old_ctx, TALLOC_CTX *new_ctx,
|
||||||
|
DATA_BLOB *old)
|
||||||
|
{
|
||||||
|
DATA_BLOB new;
|
||||||
|
new = *old;
|
||||||
|
new.data = talloc_steal(old_ctx, new_ctx, old->data);
|
||||||
|
if (new.data == NULL) {
|
||||||
|
smb_panic("data_blob_talloc_steal: talloc_steal failed.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
free a data blob
|
free a data blob
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user