diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/talloc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c index 7b6e987bc0..6d5f946e5c 100644 --- a/source3/lib/talloc.c +++ b/source3/lib/talloc.c @@ -184,6 +184,7 @@ void *talloc(TALLOC_CTX *t, size_t size) void *talloc_realloc(TALLOC_CTX *t, void *ptr, size_t size) { struct talloc_chunk *tc; + void *new_ptr; /* size zero is equivalent to free() */ if (size == 0) @@ -195,13 +196,13 @@ void *talloc_realloc(TALLOC_CTX *t, void *ptr, size_t size) for (tc=t->list; tc; tc=tc->next) { if (tc->ptr == ptr) { - ptr = Realloc(ptr, size); - if (ptr) { + new_ptr = Realloc(ptr, size); + if (new_ptr) { t->total_alloc_size += (size - tc->size); tc->size = size; - tc->ptr = ptr; + tc->ptr = new_ptr; } - return ptr; + return new_ptr; } } return NULL; @@ -362,7 +363,7 @@ char *talloc_describe_all(TALLOC_CTX *rt) TALLOC_CTX *it; char *s; - s = talloc_asprintf(rt, "global talloc allocations in pid%u:\n", + s = talloc_asprintf(rt, "global talloc allocations in pid: %u\n", (unsigned) getpid()); s = talloc_asprintf_append(rt, s, "%-40s %8s %8s\n", "name", "chunks", "bytes"); |