diff --git a/plugins/windows/src/native/dx8/net_java_games_input_IDirectInputDevice.c b/plugins/windows/src/native/dx8/net_java_games_input_IDirectInputDevice.c index 11e7141..9f29191 100644 --- a/plugins/windows/src/native/dx8/net_java_games_input_IDirectInputDevice.c +++ b/plugins/windows/src/native/dx8/net_java_games_input_IDirectInputDevice.c @@ -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) {