Windows: Added missing NULL check after SDL_stack_alloc().
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 06 Dec 2015 17:51:11 +0100
changeset 9946 6f852b334192
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
--- a/src/video/windows/SDL_windowsframebuffer.c	Sun Dec 06 17:50:51 2015 +0100
+++ b/src/video/windows/SDL_windowsframebuffer.c	Sun Dec 06 17:51:11 2015 +0100
@@ -42,6 +42,9 @@
     /* Find out the format of the screen */
     size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD);
     info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size);
+    if (!info) {
+        return SDL_OutOfMemory();
+    }
 
     SDL_memset(info, 0, size);
     info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);