leak: free per-locale cached order data (has additional refcount)

This commit is contained in:
Enno Rehling 2015-10-13 23:25:44 +02:00
parent 377b0d0305
commit a3210aaed7
3 changed files with 11 additions and 0 deletions

View file

@ -267,6 +267,13 @@ static void free_localedata(int lindex) {
locale_array[lindex]->lang = 0;
}
void close_orders(void) {
int i;
for (i = 0; i != MAXLOCALES; ++i) {
if (locale_array[i]) free_localedata(i);
}
}
static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
const struct locale *lang)
{

View file

@ -61,6 +61,8 @@ extern "C" {
char *write_order(const order * ord, char *buffer, size_t size);
keyword_t init_order(const struct order *ord);
void close_orders(void);
#ifdef __cplusplus
}
#endif

View file

@ -9,6 +9,7 @@
#include <kernel/terrain.h>
#include <kernel/item.h>
#include <kernel/unit.h>
#include <kernel/order.h>
#include <kernel/race.h>
#include <kernel/faction.h>
#include <kernel/building.h>
@ -79,6 +80,7 @@ void test_cleanup(void)
global.functions.wage = NULL;
free_params(&global.parameters);
default_locale = 0;
close_orders();
free_locales();
free_spells();
free_buildingtypes();