From 7d426dc3ed1ca46d0394e54857d48b080f135a46 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 10 Jan 2016 12:07:00 +0100 Subject: [PATCH] call destroyfaction instead of free as a quick fix --- src/kernel/faction.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 6bc28e3e6..1ca85aa8d 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -322,7 +322,7 @@ variant read_faction_reference(struct storage * store) void write_faction_reference(const faction * f, struct storage *store) { - WRITE_INT(store, f ? f->no : 0); + WRITE_INT(store, (f && f->alive) ? f->no : 0); } void destroyfaction(faction * f) @@ -681,7 +681,9 @@ void remove_empty_factions(void) if (f->alliance && f->alliance->_leader == f) { setalliance(f, 0); } - free(f); + destroyfaction(f); // TODO: there was a free() here, + // are we duplicating efforts here that also happen + // in destroyfaction? } else fp = &(*fp)->next;