diff --git a/.gitmodules b/.gitmodules index 62178e1a1..7e795bf4e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,31 +1,31 @@ [submodule "lunit"] path = lunit - url = git://github.com/ennorehling/lunit.git + url = git@github.com:ennorehling/lunit.git [submodule "cmake"] path = cmake - url = git://github.com/ennorehling/cmake.git + url = git@github.com:ennorehling/cmake.git [submodule "quicklist"] path = quicklist - url = git://github.com/ennorehling/quicklist.git + url = git@github.com:ennorehling/quicklist.git [submodule "critbit"] path = critbit - url = git://github.com/ennorehling/critbit.git + url = git@github.com:ennorehling/critbit.git [submodule "dlmalloc"] path = dlmalloc - url = git://github.com/ennorehling/dlmalloc.git + url = git@github.com:ennorehling/dlmalloc.git [submodule "cutest"] path = cutest - url = git://github.com/ennorehling/cutest.git + url = git@github.com:ennorehling/cutest.git [submodule "iniparser"] path = iniparser - url = git://github.com/ennorehling/iniparser.git + url = git@github.com:ennorehling/iniparser.git [submodule "cJSON"] path = cJSON - url = git://github.com/ennorehling/cJSON.git + url = git@github.com:ennorehling/cJSON.git [submodule "storage"] path = storage - url = git://github.com/ennorehling/storage.git + url = git@github.com:ennorehling/storage.git branch = master [submodule "tolua"] path = tolua - url = git://github.com/ennorehling/tolua.git + url = git@github.com:ennorehling/tolua.git diff --git a/critbit b/critbit index 934c2dd94..971836241 160000 --- a/critbit +++ b/critbit @@ -1 +1 @@ -Subproject commit 934c2dd94d41da19637a76a1a8b3dfeb7aa8524d +Subproject commit 971836241277e37274aa3110344836499816ff21 diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 69231ff43..8ca5297b0 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -872,6 +872,7 @@ void free_factions(void) { while (deadhash[i]) { dead *d = deadhash[i]; deadhash[i] = d->nexthash; + free(d); } } free_flist(&factions); diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c index ecd0df2ab..0d7e7b877 100644 --- a/src/kernel/faction.test.c +++ b/src/kernel/faction.test.c @@ -191,10 +191,30 @@ static void test_set_origin_bug(CuTest *tc) { test_cleanup(); } +static void test_deadhash(CuTest *tc) { + faction *f; + int no; + + test_setup(); + f = test_create_faction(0); + no = f->no; + CuAssertPtrEquals(tc, f, findfaction(no)); + CuAssertPtrEquals(tc, NULL, dfindhash(42)); + dhash(41, f); + dhash(42, f); + assert(f == factions); + destroyfaction(&factions); + CuAssertPtrEquals(tc, 0, findfaction(no)); + CuAssertPtrEquals(tc, f, dfindhash(42)); + CuAssertPtrEquals(tc, f, dfindhash(41)); + test_cleanup(); +} + CuSuite *get_faction_suite(void) { CuSuite *suite = CuSuiteNew(); SUITE_ADD_TEST(suite, test_addfaction); + SUITE_ADD_TEST(suite, test_deadhash); SUITE_ADD_TEST(suite, test_remove_empty_factions); SUITE_ADD_TEST(suite, test_destroyfaction_allies); SUITE_ADD_TEST(suite, test_remove_empty_factions_alliance);