Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] Re: (PR#6650) memory leak in remove_city
Home

[Freeciv-Dev] Re: (PR#6650) memory leak in remove_city

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#6650) memory leak in remove_city
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 27 Oct 2003 12:51:19 -0800
Reply-to: rt@xxxxxxxxxxxxxx

Jason Short wrote:
> The mystrdup in remove_city() in citytools.c is not fully matched by a 
> free() call.

Patch attached.

jason

Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.237
diff -u -r1.237 citytools.c
--- server/citytools.c  2003/10/13 01:33:31     1.237
+++ server/citytools.c  2003/10/27 20:50:40
@@ -1202,8 +1202,9 @@
      savepalace is on. */
   if (had_palace && game.savepalace) {
     build_free_palace(pplayer, city_name);
-    free(city_name);
   }
+
+  free(city_name);
 
   sync_cities();
 }

[Prev in Thread] Current Thread [Next in Thread]