From 089ae5e43543a4654dddd42d61eb84a8036c4780 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 14 Dec 2003 03:51:48 +0000 Subject: fixed some memory leaks in the rpc server code (This used to be commit 20458556017f426ab57ca9a9d098cacecefbdcff) --- source4/lib/talloc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib') 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)); -- cgit