Checking memory allocation return values helps prevent crashes