From ded5b3a4b423be4fcfdb8c686280e96858753d38 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 27 Aug 2017 21:05:18 -0700 Subject: [PATCH] Fixed crash at shutdown if the window couldn't be created --- src/test/SDL_test_common.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index c9bcbaf06..a71f5dc0f 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -822,13 +822,13 @@ SDLTest_CommonInit(SDLTest_CommonState * state) fullscreen_mode.refresh_rate = state->refresh_rate; state->windows = - (SDL_Window **) SDL_malloc(state->num_windows * + (SDL_Window **) SDL_calloc(state->num_windows, sizeof(*state->windows)); state->renderers = - (SDL_Renderer **) SDL_malloc(state->num_windows * + (SDL_Renderer **) SDL_calloc(state->num_windows, sizeof(*state->renderers)); state->targets = - (SDL_Texture **) SDL_malloc(state->num_windows * + (SDL_Texture **) SDL_calloc(state->num_windows, sizeof(*state->targets)); if (!state->windows || !state->renderers) { SDL_Log("Out of memory!\n"); @@ -881,9 +881,6 @@ SDLTest_CommonInit(SDLTest_CommonState * state) SDL_ShowWindow(state->windows[i]); - state->renderers[i] = NULL; - state->targets[i] = NULL; - if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) {