Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] Re: (PR#18758) [Bug] Memory leak in ai_manage_airunit()
Home

[Freeciv-Dev] Re: (PR#18758) [Bug] Memory leak in ai_manage_airunit()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#18758) [Bug] Memory leak in ai_manage_airunit()
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Thu, 20 Jul 2006 14:25:46 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Marko Lindqvist wrote:
> 
>  S2_1
> 
> ==6294== 2,531,788 (35,352 direct, 2,496,436 indirect) bytes in 2,354
> blocks are definitely lost in loss record 4 of 7
> ==6294==    at 0x401C422: malloc (vg_replace_malloc.c:149)
> ==6294==    by 0x804BD3D: fc_real_malloc (mem.c:82)
> ==6294==    by 0x80B04D3: pq_create (pqueue.c:48)
> ==6294==    by 0x80AB11B: refuel_iterate_init (airgoto.c:206)
> ==6294==    by 0x81108CA: ai_manage_airunit (aiair.c:229)
> ==6294==    by 0x8127890: ai_manage_unit (aiunit.c:2145)
> ==6294==    by 0x812801F: ai_manage_units (aiunit.c:2257)
> ==6294==    by 0x8118DB1: ai_do_first_activities (aihand.c:425)
> ==6294==    by 0x80523B4: main_loop (srv_main.c:506)
> ==6294==    by 0x8053018: srv_main (srv_main.c:1937)
> ==6294==    by 0x804A66B: main (civserver.c:256)

  Untested patch


  - ML

diff -Nurd -X.diff_ignore freeciv/ai/aiair.c freeciv/ai/aiair.c
--- freeciv/ai/aiair.c  2006-07-20 21:38:14.437500000 +0300
+++ freeciv/ai/aiair.c  2006-07-21 00:24:04.218750000 +0300
@@ -23,6 +23,7 @@
 #include "map.h"
 #include "movement.h"
 #include "player.h"
+#include "pqueue.h"
 #include "unit.h"
 
 #include "airgoto.h"
@@ -266,6 +267,8 @@
     refuel_iterate_process(airbase_iterator, airbase);
   }
 
+  pq_destroy(airbase_iterator);
+
   return found;
 }
 

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