From 4fc5ac7740ffa6a0863f4c0054c136e5e6cf675c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 14 Oct 2015 12:51:45 +0200 Subject: [PATCH] there is a memory leak in test_long_order_hungry, but the root cause lies deeper --- src/kernel/config.c | 2 ++ src/kernel/curse.test.c | 3 ++- src/laws.test.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index 1db17a495..3410f7bff 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1611,6 +1611,8 @@ void set_default_order(int kwd) { default_keyword = (keyword_t)kwd; } +// TODO: outside of tests, default_keyword is never used, why is this here? +// see also test_long_order_hungry order *default_order(const struct locale *lang) { static int usedefault = 1; diff --git a/src/kernel/curse.test.c b/src/kernel/curse.test.c index 0df115397..bf9f1c85c 100644 --- a/src/kernel/curse.test.c +++ b/src/kernel/curse.test.c @@ -33,9 +33,10 @@ static void test_curse(CuTest * tc) cid = c->no; result = findcurse(cid); CuAssertPtrEquals(tc, c, result); - destroy_curse(c); + a_remove(&attrs, attrs); result = findcurse(cid); CuAssertPtrEquals(tc, NULL, result); + test_cleanup(); } typedef struct { diff --git a/src/laws.test.c b/src/laws.test.c index 5a91d54d4..3c0be9b6a 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -999,7 +999,8 @@ static void test_long_order_buy_cast(CuTest *tc) { } static void test_long_order_hungry(CuTest *tc) { - // TODO: write more tests + // FIXME: set_default_order is a test-only function, this is a bad test. + // see also default_order unit *u; test_cleanup(); set_param(&global.parameters, "hunger.long", "1");