diff --git a/src/magic.test.c b/src/magic.test.c index 300f8cd88..35202cd69 100644 --- a/src/magic.test.c +++ b/src/magic.test.c @@ -39,6 +39,7 @@ void test_updatespells(CuTest * tc) CuAssertPtrNotNull(tc, f->spellbook); CuAssertIntEquals(tc, 1, ql_length(f->spellbook->spells)); CuAssertPtrNotNull(tc, spellbook_get(f->spellbook, sp)); + test_cleanup(); } void test_spellbooks(CuTest * tc) @@ -63,12 +64,11 @@ void test_spellbooks(CuTest * tc) entry = spellbook_get(herp, sp); CuAssertPtrNotNull(tc, entry); CuAssertPtrEquals(tc, sp, entry->sp); - /* CuAssertPtrEquals(tc, 0, spellbook_get(derp, sname)); */ test_cleanup(); herp = get_spellbook("herp"); CuAssertPtrNotNull(tc, herp); - /* CuAssertPtrEquals(tc, 0, spellbook_get(herp, sname)); */ + test_cleanup(); } static spell * test_magic_create_spell(void) @@ -215,6 +215,7 @@ void test_getspell_faction(CuTest * tc) f->spellbook = create_spellbook(0); spellbook_add(f->spellbook, sp, 1); CuAssertPtrEquals(tc, sp, unit_getspell(u, "Herp-a-derp", lang)); + test_cleanup(); } void test_getspell_school(CuTest * tc) @@ -246,6 +247,7 @@ void test_getspell_school(CuTest * tc) CuAssertPtrNotNull(tc, book); spellbook_add(book, sp, 1); CuAssertPtrEquals(tc, sp, unit_getspell(u, "Herp-a-derp", lang)); + test_cleanup(); } void test_set_pre_combatspell(CuTest * tc) @@ -278,6 +280,7 @@ void test_set_pre_combatspell(CuTest * tc) unset_combatspell(u, sp); CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index)); CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index)); + test_cleanup(); } void test_set_main_combatspell(CuTest * tc) @@ -310,6 +313,7 @@ void test_set_main_combatspell(CuTest * tc) unset_combatspell(u, sp); CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index)); CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index)); + test_cleanup(); } void test_set_post_combatspell(CuTest * tc) @@ -342,6 +346,7 @@ void test_set_post_combatspell(CuTest * tc) unset_combatspell(u, sp); CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index)); CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index)); + test_cleanup(); } void test_hasspell(CuTest * tc) @@ -371,6 +376,7 @@ void test_hasspell(CuTest * tc) set_level(u, SK_MAGIC, 1); CuAssertTrue(tc, !u_hasspell(u, sp)); + test_cleanup(); } CuSuite *get_magic_suite(void) diff --git a/src/util/language.c b/src/util/language.c index b55afd5eb..58ad78555 100644 --- a/src/util/language.c +++ b/src/util/language.c @@ -242,6 +242,7 @@ void add_translation(struct critbit_tree **cbp, const char *key, int i) { if (str) { size_t len = strlen(str); if (!cb) { + // TODO: this will leak, because we do not know how to clean it up */ *cbp = cb = (struct critbit_tree *)calloc(1, sizeof(struct critbit_tree *)); } len = cb_new_kv(str, len, &i, sizeof(int), buffer); diff --git a/src/util/umlaut.c b/src/util/umlaut.c index 61dc06ba1..6917960cc 100644 --- a/src/util/umlaut.c +++ b/src/util/umlaut.c @@ -212,6 +212,7 @@ void freetokens(void * root) for (i = 0; node && i != NODEHASHSIZE; ++i) { if (node->next[i]) { freetokens(node->next[i]->node); + free(node->next[i]); } } free(node);