diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index e997df94f..63a1067fc 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -697,20 +697,28 @@ ffindhash(int no) void stripfaction (faction * f) { - /* TODO: inhalt auch löschen */ - if (f->msgs) free(f->msgs); - if (f->battles) free(f->battles); + /* TODO: inhalt auch löschen */ + if (f->msgs) free_messagelist(f->msgs); + while (f->battles) { + struct bmsg * b = f->battles; + f->battles = b->next; + free_messagelist(b->msgs); + } - /* TODO: free msgs */ - freelist(f->allies); - free(f->email); - free(f->banner); - free(f->passw); - free(f->override); - free(f->name); - while (f->attribs) a_remove (&f->attribs, f->attribs); - freelist(f->ursprung); - funhash(f); + freelist(f->allies); + + free(f->email); + free(f->banner); + free(f->passw); + free(f->override); + free(f->name); + + while (f->attribs) a_remove (&f->attribs, f->attribs); + + i_freeall(f->items); + + freelist(f->ursprung); + funhash(f); } void diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index afac30253..330731443 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -104,7 +104,7 @@ #include #include -#ifdef USE_DMALLOC +#if defined(USE_DMALLOC) # define CLEANUP_CODE #endif @@ -372,6 +372,9 @@ process_orders() return 0; } +#ifndef CLEANUP_CODE +# define CLEANUP_CODE +#endif #ifdef CLEANUP_CODE static void game_done(void)