As Jens Gustedt noted in a comment, by the time an malloc()error returns, in which your program is probably already on the heap of problems. Does it make sense to put in a bunch of error handling code to handle a situation where the program probably won't be able to do anything at all? For many programs, the answer may be no, for others it may be very important to do something appropriate.
You can try to allocate your memory using the simple "malloc-or-die" function, which ensures that the allocation is successful or the program terminates:
void* m_malloc(size_t size)
{
void* p;
if (size == 0) size = 1;
p = malloc(size);
if (!p) {
abort();
}
return p;
}
, , , , , , . , , , , , ( ).
, "" , , ( , , ). , , . , - , malloc() , , , . , , .