diff options
-rw-r--r-- | source4/lib/data_blob.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/lib/data_blob.c b/source4/lib/data_blob.c index 3667d453b9..a6e6672b90 100644 --- a/source4/lib/data_blob.c +++ b/source4/lib/data_blob.c @@ -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 *******************************************************************/ |