fix errors in the order of cleanup

This commit is contained in:
Enno Rehling 2016-01-11 18:03:53 +01:00
parent 04e2fb73c7
commit 20063e0e0e
2 changed files with 5 additions and 6 deletions

View File

@ -1058,9 +1058,6 @@ void free_gamedata(void)
{ {
int i; int i;
free_donations(); free_donations();
free_units();
free_regions();
free_borders();
for (i = 0; i != MAXLOCALES; ++i) { for (i = 0; i != MAXLOCALES; ++i) {
if (defaults[i]) { if (defaults[i]) {
@ -1068,14 +1065,16 @@ void free_gamedata(void)
defaults[i] = 0; defaults[i] = 0;
} }
} }
free_alliances();
while (factions) { while (factions) {
faction *f = factions; faction *f = factions;
factions = f->next; factions = f->next;
funhash(f);
free_faction(f); free_faction(f);
free(f); free(f);
} }
free_units();
free_regions();
free_borders();
free_alliances();
while (planes) { while (planes) {
plane *pl = planes; plane *pl = planes;

View File

@ -78,6 +78,7 @@ void test_cleanup(void)
{ {
int i; int i;
free_gamedata();
free_terrains(); free_terrains();
free_resources(); free_resources();
free_config(); free_config();
@ -89,7 +90,6 @@ void test_cleanup(void)
free_shiptypes(); free_shiptypes();
free_races(); free_races();
free_spellbooks(); free_spellbooks();
free_gamedata();
free_seen(); free_seen();
free_prefixes(); free_prefixes();
mt_clear(); mt_clear();