Check the return value of all memory allocation operations