summaryrefslogtreecommitdiff
path: root/source4/lib/talloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/talloc.c')
-rw-r--r--source4/lib/talloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c
index 25871feac1..59d4eac500 100644
--- a/source4/lib/talloc.c
+++ b/source4/lib/talloc.c
@@ -490,7 +490,9 @@ void talloc_free(TALLOC_CTX *ctx, void *ptr)
list */
if (ctx->list->ptr == ptr) {
ctx->total_alloc_size -= ctx->list->size;
+ tc = ctx->list;
ctx->list = ctx->list->next;
+ free(tc);
free(ptr);
return;
}
@@ -501,8 +503,11 @@ void talloc_free(TALLOC_CTX *ctx, void *ptr)
}
if (tc->next) {
+ struct talloc_chunk *tc2 = tc->next;
ctx->total_alloc_size -= tc->next->size;
tc->next = tc->next->next;
+ free(tc2);
+ free(ptr);
} else {
DEBUG(0,("Attempt to free non-allocated chunk in context '%s'\n",
ctx->name));