summaryrefslogtreecommitdiffstats
path: root/source/lib/talloc.c
diff options
context:
space:
mode:
authorJean-François Micouleau <jfm@samba.org>2002-01-25 17:02:54 +0000
committerJean-François Micouleau <jfm@samba.org>2002-01-25 17:02:54 +0000
commit873dba59cf4e1f7ebb3593d890b9de7c8cd25653 (patch)
treeb527847fd8e33e08a9731d035d6b8416fbac54fc /source/lib/talloc.c
parent7dc1c34145d66f4bbc5c6ce0bca4b224088366af (diff)
downloadsamba-873dba59cf4e1f7ebb3593d890b9de7c8cd25653.tar.gz
samba-873dba59cf4e1f7ebb3593d890b9de7c8cd25653.tar.xz
samba-873dba59cf4e1f7ebb3593d890b9de7c8cd25653.zip
picky about realloc
J.F.
Diffstat (limited to 'source/lib/talloc.c')
-rw-r--r--source/lib/talloc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/lib/talloc.c b/source/lib/talloc.c
index 7b6e987bc09..6d5f946e5c2 100644
--- a/source/lib/talloc.c
+++ b/source/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");