mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Prevent null pointer dereferences
This commit is contained in:
parent
e321d34d08
commit
01ab13f62c
1 changed files with 11 additions and 8 deletions
19
dynamic.c
19
dynamic.c
|
@ -1352,15 +1352,18 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||||
info[i].types[j].id);
|
info[i].types[j].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(system->ports.data);
|
if (system)
|
||||||
system->ports.data = (struct retro_controller_info*)
|
{
|
||||||
calloc(i, sizeof(*system->ports.data));
|
free(system->ports.data);
|
||||||
if (!system->ports.data)
|
system->ports.data = (struct retro_controller_info*)
|
||||||
return false;
|
calloc(i, sizeof(*system->ports.data));
|
||||||
|
if (!system->ports.data)
|
||||||
|
return false;
|
||||||
|
|
||||||
memcpy(system->ports.data, info,
|
memcpy(system->ports.data, info,
|
||||||
i * sizeof(*system->ports.data));
|
i * sizeof(*system->ports.data));
|
||||||
system->ports.size = i;
|
system->ports.size = i;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue