fixed unsafe usage of malloc() pointed out by jtsiomb.
(cherry picked from commitaa5514903d
) (cherry picked from commitaa5514903d
) git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1764 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
8dfbfaca71
commit
8cafe7e34c
@ -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);
|
||||
|
||||
|
@ -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));
|
||||
|
Reference in New Issue
Block a user