summaryrefslogtreecommitdiff
path: root/source3/lib/talloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/talloc.c')
-rw-r--r--source3/lib/talloc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c
index 854a230a0e..54a3d8ed76 100644
--- a/source3/lib/talloc.c
+++ b/source3/lib/talloc.c
@@ -139,3 +139,16 @@ void *talloc_zero(TALLOC_CTX *t, size_t size)
return p;
}
+
+/* memdup with a talloc. */
+void *talloc_memdup(TALLOC_CTX *t, void *p, size_t size)
+{
+ void *newp = talloc(t,size);
+
+ if (!newp)
+ return 0;
+
+ memcpy(newp, p, size);
+
+ return newp;
+}