mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 03:10:14 +00:00
dinput: Guard against the case where malloc fails
This commit is contained in:
parent
fd001f6b52
commit
736561ecbe
@ -24,6 +24,7 @@
|
||||
#include "../general.h"
|
||||
#include "../boolean.h"
|
||||
#include "input_common.h"
|
||||
#include "retroarch_logger.h"
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user