Merge pull request #9 from nlguillemot/master

woops: didnt allocate enough and also clear to zero.
This commit is contained in:
Daniel Collin 2017-01-24 18:48:18 +01:00 committed by GitHub
commit 494af34aab

View File

@ -1,4 +1,4 @@
#include <MiniFB.h> #include "MiniFB.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
@ -95,7 +95,7 @@ int mfb_open(const char* title, int width, int height)
ShowWindow(s_wnd, SW_NORMAL); 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.biSize = sizeof(BITMAPINFOHEADER);
s_bitmapInfo->bmiHeader.biPlanes = 1; s_bitmapInfo->bmiHeader.biPlanes = 1;
s_bitmapInfo->bmiHeader.biBitCount = 32; s_bitmapInfo->bmiHeader.biBitCount = 32;