From 736561ecbe40ff7fd132cb6021bc58f021711546 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 11 Sep 2014 20:41:46 -0400 Subject: [PATCH] dinput: Guard against the case where malloc fails --- input/dinput.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/input/dinput.c b/input/dinput.c index 23bcaaaef5..07e17d1783 100644 --- a/input/dinput.c +++ b/input/dinput.c @@ -24,6 +24,7 @@ #include "../general.h" #include "../boolean.h" #include "input_common.h" +#include "retroarch_logger.h" #include #include #include @@ -483,6 +484,12 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa { struct pointer_status *new_pointer = (struct pointer_status *)malloc(sizeof(struct pointer_status)); + if (!new_pointer) + { + RARCH_ERR("dinput_handle_message: pointer allocation in WM_POINTERDOWN failed.\n"); + return false; + } + new_pointer->pointer_id = GET_POINTERID_WPARAM(wParam); dinput_pointer_store_pos(new_pointer, lParam); dinput_add_pointer(di, new_pointer);