mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2025-12-06 08:01:59 +01:00
Check for NULL malloc result
This commit is contained in:
parent
c31a7d8818
commit
027fa2a7a0
|
|
@ -352,6 +352,8 @@ JNIEXPORT jint JNICALL Java_net_java_games_input_IDirectInputDevice_nGetDeviceDa
|
|||
return -1;
|
||||
|
||||
data = (DIDEVICEOBJECTDATA *)malloc(num_events*sizeof(DIDEVICEOBJECTDATA));
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
|
||||
res = IDirectInputDevice8_GetDeviceData(lpDevice, sizeof(DIDEVICEOBJECTDATA), data, &num_events, flags);
|
||||
if (res == DI_OK || res == DI_BUFFEROVERFLOW) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue