From ae1ea5619b18be9c37f9647756e06718b17b88f2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 24 Mar 2005 08:00:15 +0000 Subject: r6033: Patch from 'lifeless' to clarify behaviour with NULL pointers. Andrew Bartlett (This used to be commit 48c518796797f021c9c7f319ca8cd0a0c185f64c) --- source4/lib/talloc/talloc.c | 3 ++- source4/lib/talloc/talloc_guide.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index 31796a247b..0d78dd8d24 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -609,7 +609,8 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n /* move a lump of memory from one talloc context to another return the - ptr on success, or NULL if it could not be transferred + ptr on success, or NULL if it could not be transferred. + passing NULL as ptr will always return NULL with no side effects. */ void *talloc_steal(const void *new_ctx, const void *ptr) { diff --git a/source4/lib/talloc/talloc_guide.txt b/source4/lib/talloc/talloc_guide.txt index 4ab0f8eacc..aca3ab4937 100644 --- a/source4/lib/talloc/talloc_guide.txt +++ b/source4/lib/talloc/talloc_guide.txt @@ -306,6 +306,7 @@ NOTE: It is possible to produce loops in the parent/child relationship if you are not careful with talloc_steal(). No guarantees are provided as to your sanity or the safety of your data if you do this. +talloc_steal (new_ctx, NULL) will return NULL with no sideeffects. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- off_t talloc_total_size(const void *ptr); -- cgit