1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-10 04:23:50 +03:00

Made talloc_realloc() semantics match realloc(). JF was complaining :-).

realloc(NULL) == malloc. realloc(p,0) == free() - a no-op in talloc.
Jeremy.
This commit is contained in:
Jeremy Allison
-
parent 1685e41da0
commit 1ab31e5db5

View File

@@ -80,6 +80,14 @@ void *talloc_realloc(TALLOC_CTX *t, void *ptr, size_t size)
{
struct talloc_chunk *tc;
/* size zero is equivalent to free() */
if (size == 0)
return NULL;
/* realloc(NULL) is equavalent to malloc() */
if (ptr == NULL)
return talloc(t, size);
for (tc=t->list; tc; tc=tc->next) {
if (tc->ptr == ptr) {
ptr = realloc(ptr, size);