allocate enough space for NUL, and do not try to open an empty file string

This commit is contained in:
Brad Parker
2016-12-31 01:56:52 -05:00
parent 309c8db34d
commit 821ca02474
3 changed files with 15 additions and 5 deletions

View File

@@ -324,8 +324,14 @@ void FCEUSS_CheckStates(void)
for (ssel = 0; ssel < 10; ssel++)
{
st = fopen(fn = FCEU_MakeFName(FCEUMKF_STATE, ssel, 0), "rb");
free(fn);
fn = FCEU_MakeFName(FCEUMKF_STATE, ssel, 0);
if (fn)
{
st = fopen(fn, "rb");
free(fn);
}
if (st)
{
SaveStateStatus[ssel] = 1;