From 027fa2a7a0258766cbcfa1cd0d2130c05d4ac7b7 Mon Sep 17 00:00:00 2001 From: elias Date: Wed, 9 Aug 2006 08:38:58 +0000 Subject: [PATCH] Check for NULL malloc result --- .../src/native/dx8/net_java_games_input_IDirectInputDevice.c | 2 ++ 1 file changed, 2 insertions(+) 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) {