Hi,
On UnixPC, realloc of a NULL pointer returns NULL, whereas on most
today's architectures it behaves the same way as malloc.
So we just wrap it.
Regards,
Alain
diff -X ../exclude.txt -urN dash-0.5.12+14-broken-wait-h/src/memalloc.c dash-0.5.12+15-realloc-null/src/memalloc.c
--- dash-0.5.12+14-broken-wait-h/src/memalloc.c 2024-10-27 20:32:54.604833876 +0000
+++ dash-0.5.12+15-realloc-null/src/memalloc.c 2024-10-27 20:32:44.700597405 +0000
@@ -68,7 +68,10 @@
pointer
ckrealloc(pointer p, size_t nbytes)
{
- p = realloc(p, nbytes);
+ if(p == NULL)
+ p = malloc(nbytes);
+ else
+ p = realloc(p, nbytes);
if (p == NULL)
sh_error("Out of space");
return p;