summaryrefslogtreecommitdiff
path: root/source3
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
commitb387638d48dca216847cbd95c08c41b0b66d149d (patch)
treefed4d3b9a4299e761ff2f039f33a96377668a528 /source3
parent107b12ec11254107ce59228fe5694a9892051b24 (diff)
downloadsamba-b387638d48dca216847cbd95c08c41b0b66d149d.tar.gz
samba-b387638d48dca216847cbd95c08c41b0b66d149d.tar.bz2
samba-b387638d48dca216847cbd95c08c41b0b66d149d.zip
picky about realloc
J.F. (This used to be commit 873dba59cf4e1f7ebb3593d890b9de7c8cd25653)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/talloc.c11
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");