forked from github/server
leak: free per-locale cached order data (has additional refcount)
This commit is contained in:
parent
377b0d0305
commit
a3210aaed7
3 changed files with 11 additions and 0 deletions
|
@ -267,6 +267,13 @@ static void free_localedata(int lindex) {
|
||||||
locale_array[lindex]->lang = 0;
|
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,
|
static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
|
||||||
const struct locale *lang)
|
const struct locale *lang)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,8 @@ extern "C" {
|
||||||
char *write_order(const order * ord, char *buffer, size_t size);
|
char *write_order(const order * ord, char *buffer, size_t size);
|
||||||
keyword_t init_order(const struct order *ord);
|
keyword_t init_order(const struct order *ord);
|
||||||
|
|
||||||
|
void close_orders(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
#include <kernel/order.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
|
@ -79,6 +80,7 @@ void test_cleanup(void)
|
||||||
global.functions.wage = NULL;
|
global.functions.wage = NULL;
|
||||||
free_params(&global.parameters);
|
free_params(&global.parameters);
|
||||||
default_locale = 0;
|
default_locale = 0;
|
||||||
|
close_orders();
|
||||||
free_locales();
|
free_locales();
|
||||||
free_spells();
|
free_spells();
|
||||||
free_buildingtypes();
|
free_buildingtypes();
|
||||||
|
|
Loading…
Reference in a new issue