commit 36ff234d95c5489a4814ef68c5928bf1de598d42
parent 5302d5272a7dbe0823fc64220a549420e8f74937
Author: sin <sin@2f30.org>
Date: Wed, 24 Jul 2013 18:43:45 +0300
No need to call free on the old pointer, just alter the state directly
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/alloc.c b/alloc.c
@@ -61,7 +61,7 @@ realloc(void *oldp, size_t nbytes)
if (chunks[i].base == oldp) {
n = chunks[i].size < nbytes ? chunks[i].size : nbytes;
memcpy(p, chunks[i].base, n);
- free(oldp);
+ chunks[i].state = FREE;
return p;
}
}