mirror of
https://github.com/samba-team/samba.git
synced 2025-01-25 06:04:04 +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:
parent
e8de8905b2
commit
66d6e26110
@ -99,6 +99,21 @@ DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length)
|
||||
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
|
||||
*******************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user