Nothing too clever, just wrappers around the standard malloc() set that check for errors and abort as appropriate.
#include "iofns.h"
#include "memfns.h"
void *my_malloc (size_t n)
{
void *p = malloc (n);
if (! p)
FatalError ("out of memory");
return (p);
}
void *my_realloc (void *orig, size_t new_n)
{
void *p = realloc (orig, new_n);
if (! p)
FatalError ("out of memory");
return (p);
}
void my_free (void *p)
{
free (p);
}