Prevent null pointer dereferences

This commit is contained in:
twinaphex 2016-06-30 17:38:16 +02:00
parent e321d34d08
commit 01ab13f62c

View file

@ -1352,6 +1352,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
info[i].types[j].id); info[i].types[j].id);
} }
if (system)
{
free(system->ports.data); free(system->ports.data);
system->ports.data = (struct retro_controller_info*) system->ports.data = (struct retro_controller_info*)
calloc(i, sizeof(*system->ports.data)); calloc(i, sizeof(*system->ports.data));
@ -1361,6 +1363,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
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;
} }