Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12443) memory leaks in CM
Home

[Freeciv-Dev] Re: (PR#12443) memory leaks in CM

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12443) memory leaks in CM
From: "Benoit Hudson" <bh@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Mar 2005 09:56:57 -0800
Reply-to: bugs@xxxxxxxxxxx

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

On Sun, Mar 06, 2005 at 09:18:09AM -0800, Per I. Mathisen wrote:
> 
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12443 >
> 
> ==3973== 672 bytes in 8 blocks are possibly lost in loss record 10 of 20
> ==3973==    at 0x1B904A90: malloc (vg_replace_malloc.c:131)
> ==3973==    by 0x804B9CC: fc_real_malloc (mem.c:75)
> ==3973==    by 0x811F902: tile_type_lattice_add (cm.c:342)
> ==3973==    by 0x8121106: cm_query_result (cm.c:1118)
> ==3973==    by 0x806B2F7: auto_arrange_workers (cityturn.c:242)
> ==3973==    by 0x810EDC8: ai_best_government (aihand.c:324)
> ==3973==    by 0x810C0EB: ai_data_phase_init (aidata.c:388)
> ==3973==    by 0x8050BBC: main_loop (srv_main.c:538)
> ==3973==    by 0x8052968: srv_main (srv_main.c:1923)
> ==3973==    by 0x804A5C6: main (civserver.c:242)

Fix attached.

Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.58
diff -b -u -p -r1.58 cm.c
--- common/aicore/cm.c  7 Jan 2005 02:59:39 -0000       1.58
+++ common/aicore/cm.c  6 Mar 2005 17:56:03 -0000
@@ -1046,6 +1046,7 @@ static void clean_lattice(struct tile_ty
 
     if (ptype->lattice_depth >= pcity->size) {
       tile_type_destroy(ptype);
+      free(ptype);
     } else {
       int ci, cj;
 

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