Skip to content

Commit

Permalink
Windows: Added missing NULL check after SDL_stack_alloc().
Browse files Browse the repository at this point in the history
SDL_stack_alloc() might wrap SDL_malloc() which can return NULL.
  • Loading branch information
philippwiesemann committed Dec 6, 2015
1 parent 96229ee commit 57f2f3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/video/windows/SDL_windowsframebuffer.c
Expand Up @@ -42,6 +42,9 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi
/* 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);
Expand Down

0 comments on commit 57f2f3b

Please sign in to comment.