forked from github/server
fix some calendar-related leaks and issues
This commit is contained in:
parent
43aacd2355
commit
cb381123ff
|
@ -38,22 +38,34 @@ void calendar_cleanup(void)
|
||||||
|
|
||||||
free(agename);
|
free(agename);
|
||||||
|
|
||||||
for (i = 0; i != seasons; ++i) {
|
if (seasonnames) {
|
||||||
free(seasonnames[i]);
|
for (i = 0; i != seasons; ++i) {
|
||||||
|
free(seasonnames[i]);
|
||||||
|
}
|
||||||
|
free(seasonnames);
|
||||||
|
seasonnames = 0;
|
||||||
}
|
}
|
||||||
free(seasonnames);
|
|
||||||
|
|
||||||
for (i = 0; i != months_per_year; ++i) {
|
if (monthnames) {
|
||||||
free(monthnames[i]);
|
for (i = 0; i != months_per_year; ++i) {
|
||||||
|
free(monthnames[i]);
|
||||||
|
}
|
||||||
|
free(storms);
|
||||||
|
storms = 0;
|
||||||
|
free(month_season);
|
||||||
|
month_season = 0;
|
||||||
|
free(monthnames);
|
||||||
|
monthnames = 0;
|
||||||
}
|
}
|
||||||
free(storms);
|
|
||||||
free(month_season);
|
|
||||||
free(monthnames);
|
|
||||||
|
|
||||||
for (i = 0; i != weeks_per_month; ++i) {
|
for (i = 0; i != weeks_per_month; ++i) {
|
||||||
free(weeknames[i]);
|
if (weeknames)
|
||||||
free(weeknames2[i]);
|
free(weeknames[i]);
|
||||||
|
if (weeknames2)
|
||||||
|
free(weeknames2[i]);
|
||||||
}
|
}
|
||||||
free(weeknames);
|
free(weeknames);
|
||||||
|
weeknames = 0;
|
||||||
free(weeknames2);
|
free(weeknames2);
|
||||||
|
weeknames2 = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <util/message.h>
|
#include <util/message.h>
|
||||||
#include <races/races.h>
|
#include <races/races.h>
|
||||||
|
|
||||||
|
#include "calendar.h"
|
||||||
#include "chaos.h"
|
#include "chaos.h"
|
||||||
#include "creport.h"
|
#include "creport.h"
|
||||||
#include "items.h"
|
#include "items.h"
|
||||||
|
@ -50,8 +51,8 @@ void game_done(void)
|
||||||
#ifdef REPORT_FORMAT_NR
|
#ifdef REPORT_FORMAT_NR
|
||||||
report_cleanup();
|
report_cleanup();
|
||||||
#endif
|
#endif
|
||||||
calendar_cleanup();
|
|
||||||
#endif
|
#endif
|
||||||
|
calendar_cleanup();
|
||||||
free_functions();
|
free_functions();
|
||||||
free_config();
|
free_config();
|
||||||
free_locales();
|
free_locales();
|
||||||
|
|
|
@ -471,6 +471,8 @@ static int parse_calendar(xmlDocPtr doc)
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(xpathMonths);
|
xmlXPathFreeObject(xpathMonths);
|
||||||
xmlXPathFreeObject(xpathSeasons);
|
xmlXPathFreeObject(xpathSeasons);
|
||||||
|
xmlFree(newyear);
|
||||||
|
newyear = NULL;
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(xpathCalendars);
|
xmlXPathFreeObject(xpathCalendars);
|
||||||
xmlXPathFreeContext(xpath);
|
xmlXPathFreeContext(xpath);
|
||||||
|
|
|
@ -3,3 +3,4 @@ turn = get_turn()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
print("trying to read data from " .. turn)
|
print("trying to read data from " .. turn)
|
||||||
eressea.read_game(turn .. ".dat")
|
eressea.read_game(turn .. ".dat")
|
||||||
|
eressea.free_game()
|
||||||
|
|
Loading…
Reference in New Issue