Check return value of SDL_malloc() (cherry picked from commit a4604cb0d616db97921a2674a63b45f3fdfb81bc)