mirror of
https://github.com/holub/mame
synced 2025-05-22 13:48:55 +03:00
maketms: Free strings on exit.
This patch will make happier the environments that do not know that "still reachable" and "leaked" are not the same thing and that exit() is a _very_ good deallocator.
This commit is contained in:
parent
23bd717b0a
commit
9bcbadbd0a
@ -911,6 +911,23 @@ static void save(const char *fname)
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static void clear_cat(instr *il, int count)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i != count; i++) {
|
||||
free(il[i].name);
|
||||
free(il[i].dasm);
|
||||
free(il[i].run);
|
||||
}
|
||||
}
|
||||
|
||||
static void clear(void)
|
||||
{
|
||||
clear_cat(cat1, 0x40);
|
||||
clear_cat(cat2, 0x80);
|
||||
clear_cat(cat3, 0x80);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc != 3) {
|
||||
@ -924,6 +941,7 @@ int main(int argc, char **argv)
|
||||
|
||||
load(argv[1]);
|
||||
save(argv[2]);
|
||||
clear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user