mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 23:18:29 +00:00
testsprite: zero initialize textures
LoadSprite destroys current textures before allocating new ones. So make sure the previous (=first) textures are valid.
This commit is contained in:
@@ -502,7 +502,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
|||||||
|
|
||||||
/* Create the windows, initialize the renderers, and load the textures */
|
/* Create the windows, initialize the renderers, and load the textures */
|
||||||
sprites =
|
sprites =
|
||||||
(SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites));
|
(SDL_Texture **)SDL_calloc(state->num_windows, sizeof(*sprites));
|
||||||
if (!sprites) {
|
if (!sprites) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
|
||||||
return SDL_APP_FAILURE;
|
return SDL_APP_FAILURE;
|
||||||
|
Reference in New Issue
Block a user