mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Fix possible memory leaks in hidpad_ps3_connect, hidpad_ps4_connect, and hidpad_wii_connect
This commit is contained in:
parent
c5512dbd5b
commit
316870201f
@ -60,9 +60,15 @@ static void* hidpad_ps3_connect(void *connect_data, uint32_t slot, send_control_
|
||||
struct hidpad_ps3_data* device = (struct hidpad_ps3_data*)
|
||||
calloc(1, sizeof(struct hidpad_ps3_data));
|
||||
|
||||
if (!device || !connection)
|
||||
if (!device)
|
||||
return NULL;
|
||||
|
||||
if (!connection)
|
||||
{
|
||||
free(device);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
device->connection = connection;
|
||||
device->slot = slot;
|
||||
device->send_control = ptr;
|
||||
|
@ -54,9 +54,15 @@ static void* hidpad_ps4_connect(void *connect_data, uint32_t slot, send_control_
|
||||
struct hidpad_ps4_data* device = (struct hidpad_ps4_data*)
|
||||
calloc(1, sizeof(struct hidpad_ps4_data));
|
||||
|
||||
if (!device || !connection)
|
||||
if (!device)
|
||||
return NULL;
|
||||
|
||||
if (!connection)
|
||||
{
|
||||
free(device);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
device->connection = connection;
|
||||
device->slot = slot;
|
||||
device->send_control = ptr;
|
||||
|
@ -463,9 +463,15 @@ static void* hidpad_wii_connect(void *data, uint32_t slot,
|
||||
struct wiimote_t *device = (struct wiimote_t*)
|
||||
calloc(1, sizeof(struct wiimote_t));
|
||||
|
||||
if (!device || !connection)
|
||||
if (!device)
|
||||
return NULL;
|
||||
|
||||
if (!connection)
|
||||
{
|
||||
free(device);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
device->connection = connection;
|
||||
device->unid = slot;
|
||||
device->state = WIIMOTE_STATE_CONNECTED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user