fixed unsafe usage of malloc() pointed out by jtsiomb.

(cherry picked from commit aa5514903d)

(cherry picked from commit aa5514903d)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1764 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2015-06-29 10:09:27 +00:00
parent 8dfbfaca71
commit 8cafe7e34c
2 changed files with 3 additions and 2 deletions

View File

@ -129,7 +129,7 @@ struct tagSFG_PlatformJoystick
/* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
/* Spaceball device functions, defined in fg_spaceball_mswin.c */
//Added by Jinrong Xie (stonexjr @ gmail.com) 12/24/2014
//Added by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam);
void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam);

View File

@ -37,6 +37,7 @@
*/
#include <GL/freeglut.h>
#include <stdlib.h>
#include "../fg_internal.h"
enum {
@ -121,7 +122,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (res == -1)
return;
rawInputBuffer = (BYTE*)malloc(size);
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
pRawInput = (PRAWINPUT)rawInputBuffer;
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));