<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39625 >

 diplhandl_free() has been only unlinking treaties from treaty list.
Attached patch makes it to also free memory allocated for treaties.

 This fixes just one bug. Treaty list handling still seems suspicious.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/diplhand.c freeciv/server/diplhand.c
--- freeciv/server/diplhand.c	2007-08-12 17:20:57.000000000 +0300
+++ freeciv/server/diplhand.c	2007-08-27 19:25:32.000000000 +0300
@@ -69,6 +69,12 @@
 **************************************************************************/
 void diplhand_free()
 {
+  /* Free memory allocated for treaties */
+  treaty_list_iterate(treaties, pt) {
+    clear_treaty(pt);
+    free(pt);
+  } treaty_list_iterate_end;
+
   treaty_list_unlink_all(treaties);
   treaty_list_free(treaties);
   treaties = NULL;
diff -Nurd -X.diff_ignore freeciv/server/diplhand.c freeciv/server/diplhand.c
--- freeciv/server/diplhand.c	2007-08-12 17:21:16.000000000 +0300
+++ freeciv/server/diplhand.c	2007-08-27 19:28:00.000000000 +0300
@@ -64,6 +64,12 @@
 **************************************************************************/
 void diplhand_free()
 {
+  /* Free memory allocated for treaties */
+  treaty_list_iterate(treaties, pt) {
+    clear_treaty(pt);
+    free(pt);
+  } treaty_list_iterate_end;
+
   treaty_list_unlink_all(&treaties);
 }
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to