Fixed crash at shutdown if the window couldn't be created
authorSam Lantinga <slouken@libsdl.org>
Sun, 27 Aug 2017 21:05:18 -0700
changeset 113704dfe40d93789
parent 11369 78b2c58e31da
child 11371 373f09e8ec92
Fixed crash at shutdown if the window couldn't be created
src/test/SDL_test_common.c
     1.1 --- a/src/test/SDL_test_common.c	Sun Aug 27 20:41:48 2017 -0700
     1.2 +++ b/src/test/SDL_test_common.c	Sun Aug 27 21:05:18 2017 -0700
     1.3 @@ -822,13 +822,13 @@
     1.4          fullscreen_mode.refresh_rate = state->refresh_rate;
     1.5  
     1.6          state->windows =
     1.7 -            (SDL_Window **) SDL_malloc(state->num_windows *
     1.8 +            (SDL_Window **) SDL_calloc(state->num_windows,
     1.9                                          sizeof(*state->windows));
    1.10          state->renderers =
    1.11 -            (SDL_Renderer **) SDL_malloc(state->num_windows *
    1.12 +            (SDL_Renderer **) SDL_calloc(state->num_windows,
    1.13                                          sizeof(*state->renderers));
    1.14          state->targets =
    1.15 -            (SDL_Texture **) SDL_malloc(state->num_windows *
    1.16 +            (SDL_Texture **) SDL_calloc(state->num_windows,
    1.17                                          sizeof(*state->targets));
    1.18          if (!state->windows || !state->renderers) {
    1.19              SDL_Log("Out of memory!\n");
    1.20 @@ -881,9 +881,6 @@
    1.21  
    1.22              SDL_ShowWindow(state->windows[i]);
    1.23  
    1.24 -            state->renderers[i] = NULL;
    1.25 -            state->targets[i] = NULL;
    1.26 -
    1.27              if (!state->skip_renderer
    1.28                  && (state->renderdriver
    1.29                      || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) {