Only in busybox-0.60.1+/libbb: tags diff -ur busybox-0.60.1/libbb/xfuncs.c busybox-0.60.1+/libbb/xfuncs.c --- busybox-0.60.1/libbb/xfuncs.c Thu Jun 28 23:22:19 2001 +++ busybox-0.60.1+/libbb/xfuncs.c Sun Oct 28 15:56:08 2001 @@ -35,7 +35,12 @@ #ifndef DMALLOC extern void *xmalloc(size_t size) { - void *ptr = malloc(size); + void *ptr; + + if (size == 0) + size++; + + ptr = malloc(size); if (!ptr) error_msg_and_die(memory_exhausted); @@ -54,6 +59,9 @@ return NULL; } + if (size == 0) + size++; + ptr = realloc(old, size); if (!ptr) error_msg_and_die(memory_exhausted); @@ -62,9 +70,18 @@ extern void *xcalloc(size_t nmemb, size_t size) { - void *ptr = calloc(nmemb, size); + void *ptr; + + if (nmemb == 0) + nmemb++; + + if (size == 0) + size++; + + ptr = calloc(nmemb, size); if (!ptr) error_msg_and_die(memory_exhausted); + return ptr; }