From 920e11a9e548bb3985bfd087c78acb65481851f1 Mon Sep 17 00:00:00 2001 From: Nicolas Guillemot Date: Tue, 24 Jan 2017 09:30:21 -0800 Subject: [PATCH] woops: didnt allocate enough and also clear to zero. --- src/windows/WinMiniFB.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/windows/WinMiniFB.c b/src/windows/WinMiniFB.c index 340ef6f..fdc1a03 100644 --- a/src/windows/WinMiniFB.c +++ b/src/windows/WinMiniFB.c @@ -1,4 +1,4 @@ -#include +#include "MiniFB.h" #define WIN32_LEAN_AND_MEAN #include @@ -95,7 +95,7 @@ int mfb_open(const char* title, int width, int height) ShowWindow(s_wnd, SW_NORMAL); - s_bitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 2); + s_bitmapInfo = (BITMAPINFO*)calloc(1, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 3); s_bitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); s_bitmapInfo->bmiHeader.biPlanes = 1; s_bitmapInfo->bmiHeader.biBitCount = 32;