diff options
-rw-r--r-- | server/util/memory.c | 19 | ||||
-rw-r--r-- | server/util/util.h | 6 |
2 files changed, 16 insertions, 9 deletions
diff --git a/server/util/memory.c b/server/util/memory.c index cf6532607..a25aa7872 100644 --- a/server/util/memory.c +++ b/server/util/memory.c @@ -1,26 +1,31 @@ -#include "util/util.h" +#include "replace.h" +#include "talloc.h" /* - * talloc_takeover + * sssd_mem_takeover * This function will take a non-talloc pointer and add it to a talloc * memory context. It will accept a destructor for the original pointer * so that when the parent memory context is freed, the non-talloc * pointer will also be freed properly. */ -TALLOC_CTX *talloc_takeover(TALLOC_CTX *mem_ctx, void *ptr, int (*destructor)(void **)) { - void **handle; +TALLOC_CTX *sssd_mem_takeover(TALLOC_CTX *mem_ctx, + void *ptr, + int (*destructor)(void **)) +{ + TALLOC_CTX **handle; if (ptr == NULL) { return NULL; } - handle = talloc_named_const(mem_ctx, sizeof(void *), "void *"); + handle = talloc_named_const(mem_ctx, sizeof(void *), + "sssd_mem_takeover destructor handle"); if (handle == NULL) { return NULL; } *handle = ptr; - talloc_set_destructor(handle,destructor); + talloc_set_destructor(handle, destructor); return handle; -}
\ No newline at end of file +} diff --git a/server/util/util.h b/server/util/util.h index 1613c9efe..bb5526e48 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -44,6 +44,8 @@ void CatchChild(void); void CatchChildLeaveStatus(void); /* from memory.c */ -//TALLOC_CTX *talloc_takeover(TALLOC_CTX *mem_ctx, void *ptr, int (*destructor)(void *), const char *type); -TALLOC_CTX *talloc_takeover(TALLOC_CTX *mem_ctx, void *ptr, int (*destructor)(void **)); +TALLOC_CTX *sssd_mem_takeover(TALLOC_CTX *mem_ctx, + void *ptr, + int (*destructor)(void **)); + #endif /* __SSSD_UTIL_H__ */ |