mirror of https://github.com/encounter/SDL.git
Windows: Added missing NULL check after SDL_stack_alloc().
SDL_stack_alloc() might wrap SDL_malloc() which can return NULL.
This commit is contained in:
parent
96229eed81
commit
57f2f3baf3
|
@ -42,6 +42,9 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi
|
||||||
/* Find out the format of the screen */
|
/* Find out the format of the screen */
|
||||||
size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD);
|
size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD);
|
||||||
info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size);
|
info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size);
|
||||||
|
if (!info) {
|
||||||
|
return SDL_OutOfMemory();
|
||||||
|
}
|
||||||
|
|
||||||
SDL_memset(info, 0, size);
|
SDL_memset(info, 0, size);
|
||||||
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
|
Loading…
Reference in New Issue