Check for memory allocation failure