Windows: Added missing NULL check after SDL_stack_alloc().
authorPhilipp Wiesemann
Sun, 06 Dec 2015 17:51:11 +0100
changeset 99466f852b334192
parent 9945 09d546e9d8a1
child 9947 3b68fd2503df
Windows: Added missing NULL check after SDL_stack_alloc().

SDL_stack_alloc() might wrap SDL_malloc() which can return NULL.
src/video/windows/SDL_windowsframebuffer.c
     1.1 --- a/src/video/windows/SDL_windowsframebuffer.c	Sun Dec 06 17:50:51 2015 +0100
     1.2 +++ b/src/video/windows/SDL_windowsframebuffer.c	Sun Dec 06 17:51:11 2015 +0100
     1.3 @@ -42,6 +42,9 @@
     1.4      /* Find out the format of the screen */
     1.5      size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD);
     1.6      info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size);
     1.7 +    if (!info) {
     1.8 +        return SDL_OutOfMemory();
     1.9 +    }
    1.10  
    1.11      SDL_memset(info, 0, size);
    1.12      info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);