diff --git a/src/kernel/build.c b/src/kernel/build.c index a6e8edc77..1f4e143df 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -991,6 +991,7 @@ void free_construction(struct construction *cons) { while (cons) { construction *next = cons->improvement; + free(cons->name); free(cons->materials); free(cons); cons = next; diff --git a/src/kernel/item.c b/src/kernel/item.c index 04274d633..8639ac5d1 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -517,6 +517,7 @@ static int icache_size; #define ICACHE_MAX 100 void item_done(void) { + icache_size = ICACHE_MAX; i_freeall(&icache); icache_size = 0; } @@ -951,7 +952,7 @@ void write_items(struct storage *store, item * ilist) static void free_itype(item_type *itype) { assert(itype); - free(itype->construction); + free_construction(itype->construction); free(itype->_appearance[0]); free(itype->_appearance[1]); free(itype); diff --git a/src/tests.test.c b/src/tests.test.c index 880956e8b..b2a90526d 100644 --- a/src/tests.test.c +++ b/src/tests.test.c @@ -27,11 +27,12 @@ static void test_resources(CuTest *tc) { rtype = rt_get_or_create("stone"); CuAssertPtrEquals(tc, (void *)rtype, (void *)rt_find("stone")); CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE)); - test_cleanup(); + free_resources(); CuAssertPtrEquals(tc, 0, rt_find("stone")); CuAssertPtrEquals(tc, 0, rt_find("peasant")); rtype = rt_get_or_create("stone"); CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE)); + test_cleanup(); } CuSuite *get_tests_suite(void) diff --git a/src/util/message.test.c b/src/util/message.test.c index d114e33f2..7d5dc03e9 100644 --- a/src/util/message.test.c +++ b/src/util/message.test.c @@ -9,6 +9,7 @@ static void test_mt_new(CuTest *tc) message_type *mt; test_setup(); mt = mt_new_va("test", "name:string", "number:int", NULL); + mt_register(mt); CuAssertPtrNotNull(tc, mt); CuAssertStrEquals(tc, "test", mt->name); CuAssertIntEquals(tc, 2, mt->nparameters);