<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40352 >
This cleans Valgrind output a bit by freeing mapqueues before server quits. - ML
diff -Nurd -X.diff_ignore freeciv/server/gotohand.c freeciv/server/gotohand.c --- freeciv/server/gotohand.c 2008-03-09 20:44:59.000000000 +0200 +++ freeciv/server/gotohand.c 2008-07-01 22:58:05.000000000 +0300 @@ -118,6 +118,21 @@ } /************************************************************************** + Free mapqueue arrays +**************************************************************************/ +void free_mapqueue(void) +{ + int i; + + for (i = 0; i < MAXARRAYS; i++) { + if (mappos_arrays[i] != NULL) { + free(mappos_arrays[i]); + mappos_arrays[i] = NULL; + } + } +} + +/************************************************************************** ... **************************************************************************/ static struct mappos_array *get_empty_array(void) diff -Nurd -X.diff_ignore freeciv/server/gotohand.h freeciv/server/gotohand.h --- freeciv/server/gotohand.h 2007-11-27 20:36:02.000000000 +0200 +++ freeciv/server/gotohand.h 2008-07-01 11:53:20.000000000 +0300 @@ -29,6 +29,8 @@ GR_FAILED /* failed for some other reason, has moves */ }; +void free_mapqueue(void); + bool is_dist_finite(int dist); enum goto_result do_unit_goto(struct unit *punit, enum goto_move_restriction restriction, diff -Nurd -X.diff_ignore freeciv/server/srv_main.c freeciv/server/srv_main.c --- freeciv/server/srv_main.c 2008-05-10 02:00:56.000000000 +0300 +++ freeciv/server/srv_main.c 2008-07-01 22:48:55.000000000 +0300 @@ -987,12 +987,17 @@ set_server_state(S_S_OVER); server_game_free(); diplhand_free(); + + /* Free all the warmap arrays */ + free_mapqueue(); + #ifdef HAVE_AUTH if (srvarg.auth_enabled) { /* If auth has been initialized */ auth_free(); } #endif /* HAVE_AUTH */ + stdinhand_free(); close_connections_and_socket(); exit(EXIT_SUCCESS);
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev