to a) not attempt the malloc and b) return an invalid pointer (1) so
that the user will crash when trying to use of free the pointer.
b) might have been accomplished before, but the malloc was done anyway.
void *gmalloc(size_t nbytes)
{
- char *rv = malloc(nbytes);
+ char *rv;
if (nbytes == 0)
- return 0;
+ return (char *)1; /* NB Return an invalid pointer - since nobody seems to check for NULL */
+ rv = malloc(nbytes);
if (rv == NULL) {
fprintf(stderr, "out of memory\n");
abort();