summaryrefslogtreecommitdiff
path: root/source4/lib/talloc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-14 03:51:48 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-14 03:51:48 +0000
commit089ae5e43543a4654dddd42d61eb84a8036c4780 (patch)
tree80805005ce6600152378113fd31a35e3e8563b45 /source4/lib/talloc.c
parent8f6b3eb1a9c1e996330b0edfb312b2345e292819 (diff)
downloadsamba-089ae5e43543a4654dddd42d61eb84a8036c4780.tar.gz
samba-089ae5e43543a4654dddd42d61eb84a8036c4780.tar.bz2
samba-089ae5e43543a4654dddd42d61eb84a8036c4780.zip
fixed some memory leaks in the rpc server code
(This used to be commit 20458556017f426ab57ca9a9d098cacecefbdcff)
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));