From 87328a0e927d2d4ffe8bbcd770aa57aa7d6b123a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 8 Sep 2016 21:01:58 +0200 Subject: [PATCH] eliminate memory leak in a test. --- src/kernel/save.test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/kernel/save.test.c b/src/kernel/save.test.c index e45b2f9f0..f9998367a 100644 --- a/src/kernel/save.test.c +++ b/src/kernel/save.test.c @@ -64,15 +64,17 @@ static void test_readwrite_unit(CuTest * tc) data.strm.api->rewind(data.strm.handle); free_gamedata(); f = test_create_faction(0); + r = test_create_region(0, 0, 0); renumber_faction(f, fno); gamedata_init(&data, &store, RELEASE_VERSION); u = read_unit(&data); - mstream_done(&data.strm); - gamedata_done(&data); - CuAssertPtrNotNull(tc, u); CuAssertPtrEquals(tc, f, u->faction); CuAssertPtrEquals(tc, 0, u->region); + + mstream_done(&data.strm); + gamedata_done(&data); + move_unit(u, r, NULL); // this makes sure that u doesn't leak test_cleanup(); }