mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 19:21:27 +00:00
Merge pull request #1145 from lioncash/leaks
Fix possible memory leaks in hidpad_ps3_connect, hidpad_ps4_connect, and hidpad_wii_connect
This commit is contained in:
commit
fb149fbab6
@ -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*)
|
struct hidpad_ps3_data* device = (struct hidpad_ps3_data*)
|
||||||
calloc(1, sizeof(struct hidpad_ps3_data));
|
calloc(1, sizeof(struct hidpad_ps3_data));
|
||||||
|
|
||||||
if (!device || !connection)
|
if (!device)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (!connection)
|
||||||
|
{
|
||||||
|
free(device);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
device->connection = connection;
|
device->connection = connection;
|
||||||
device->slot = slot;
|
device->slot = slot;
|
||||||
device->send_control = ptr;
|
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*)
|
struct hidpad_ps4_data* device = (struct hidpad_ps4_data*)
|
||||||
calloc(1, sizeof(struct hidpad_ps4_data));
|
calloc(1, sizeof(struct hidpad_ps4_data));
|
||||||
|
|
||||||
if (!device || !connection)
|
if (!device)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (!connection)
|
||||||
|
{
|
||||||
|
free(device);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
device->connection = connection;
|
device->connection = connection;
|
||||||
device->slot = slot;
|
device->slot = slot;
|
||||||
device->send_control = ptr;
|
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*)
|
struct wiimote_t *device = (struct wiimote_t*)
|
||||||
calloc(1, sizeof(struct wiimote_t));
|
calloc(1, sizeof(struct wiimote_t));
|
||||||
|
|
||||||
if (!device || !connection)
|
if (!device)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (!connection)
|
||||||
|
{
|
||||||
|
free(device);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
device->connection = connection;
|
device->connection = connection;
|
||||||
device->unid = slot;
|
device->unid = slot;
|
||||||
device->state = WIIMOTE_STATE_CONNECTED;
|
device->state = WIIMOTE_STATE_CONNECTED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user