Check for NULL in case of a failed memory allocation.