Make sure ipfile malloc gets freed in any case.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@562 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2010-05-08 09:02:46 +00:00
parent 70be86720c
commit fecd1b9361
1 changed files with 7 additions and 4 deletions

View File

@ -205,7 +205,7 @@ ttyrec_main (int game, char *username, char *ttyrec_path, char* ttyrec_filename)
sleep(1);
}
unlink (ipfile);
remove_ipfile();
child = 0;
return 0;
@ -359,7 +359,7 @@ done ()
(void) tcsetattr (0, TCSAFLUSH, &tt);
}
unlink(ipfile);
remove_ipfile();
graceful_exit (0);
}
@ -403,6 +403,9 @@ getslave ()
void
remove_ipfile (void)
{
if (ipfile != NULL)
unlink (ipfile);
if (ipfile != NULL) {
unlink (ipfile);
free(ipfile);
ipfile = NULL;
}
}