Check for NULL malloc result

This commit is contained in:
elias 2006-08-09 08:38:58 +00:00
parent c31a7d8818
commit 027fa2a7a0

View file

@ -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) {