Fixed bug 2130 - Two members of Windows WindowData not initialized
authorSam Lantinga <slouken@libsdl.org>
Thu, 03 Oct 2013 00:54:58 -0700
changeset 7775dad9001a9fc7
parent 7774 c5d6c8c001be
child 7776 d4a39491577f
Fixed bug 2130 - Two members of Windows WindowData not initialized

norfanin

SetupWindowData in SDL_windowswindow.c doesn't initialize two members of SDL_WindowData with NULL. This is an issue because other parts of the SDL code seem to make the assumption that this is the case. WIN_DestroyWindowFramebuffer for example uses data->mdc and data->hbm if they're not NULL.
src/video/windows/SDL_windowswindow.c
     1.1 --- a/src/video/windows/SDL_windowswindow.c	Wed Oct 02 22:18:04 2013 -0400
     1.2 +++ b/src/video/windows/SDL_windowswindow.c	Thu Oct 03 00:54:58 2013 -0700
     1.3 @@ -113,7 +113,7 @@
     1.4      SDL_WindowData *data;
     1.5  
     1.6      /* Allocate the window data */
     1.7 -    data = (SDL_WindowData *) SDL_malloc(sizeof(*data));
     1.8 +    data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
     1.9      if (!data) {
    1.10          return SDL_OutOfMemory();
    1.11      }