summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/alloc_realloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstddjb/alloc_realloc.c b/src/libstddjb/alloc_realloc.c
index 82be92b..6d5c680 100644
--- a/src/libstddjb/alloc_realloc.c
+++ b/src/libstddjb/alloc_realloc.c
@@ -5,8 +5,9 @@
int alloc_realloc (char **x, size_t n)
{
- char *y = n ? (char *)realloc(*x, n) : (free(*x), (char *)alloc(0)) ;
+ char *y = n ? realloc(*x, n) : alloc(0) ;
if (!y) return 0 ;
+ if (!n) free(*x) ;
*x = y ;
return 1 ;
}