mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-09 19:02:37 +00:00
Prevent null pointer dereferences
This commit is contained in:
parent
e321d34d08
commit
01ab13f62c
19
dynamic.c
19
dynamic.c
@ -1352,15 +1352,18 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
info[i].types[j].id);
|
||||
}
|
||||
|
||||
free(system->ports.data);
|
||||
system->ports.data = (struct retro_controller_info*)
|
||||
calloc(i, sizeof(*system->ports.data));
|
||||
if (!system->ports.data)
|
||||
return false;
|
||||
if (system)
|
||||
{
|
||||
free(system->ports.data);
|
||||
system->ports.data = (struct retro_controller_info*)
|
||||
calloc(i, sizeof(*system->ports.data));
|
||||
if (!system->ports.data)
|
||||
return false;
|
||||
|
||||
memcpy(system->ports.data, info,
|
||||
i * sizeof(*system->ports.data));
|
||||
system->ports.size = i;
|
||||
memcpy(system->ports.data, info,
|
||||
i * sizeof(*system->ports.data));
|
||||
system->ports.size = i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user