Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10612) aidata memory leak
Home

[Freeciv-Dev] (PR#10612) aidata memory leak

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10612) aidata memory leak
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Oct 2004 22:07:04 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10612 >

==30162== 3456 bytes in 218 blocks are definitely lost in loss record 13 
of 16
==30162==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
==30162==    by 0x804B512: fc_real_malloc (mem.c:79)
==30162==    by 0x804B607: fc_real_calloc (mem.c:124)
==30162==    by 0x811CF4E: ai_data_turn_init (aidata.c:150)
==30162==    by 0x804FD3F: begin_phase (srv_main.c:515)
==30162==    by 0x8051A96: main_loop (srv_main.c:1529)
==30162==    by 0x8052349: srv_loop (srv_main.c:1882)
==30162==    by 0x8051CA6: srv_main (srv_main.c:1648)
==30162==    by 0x804A94E: main (civserver.c:170)

Patch attached.  Though it seems like it would be easier and faster to 
just use realloc.

jason

Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.44
diff -u -r1.44 aidata.c
--- ai/aidata.c 29 Sep 2004 02:24:18 -0000      1.44
+++ ai/aidata.c 19 Oct 2004 05:03:18 -0000
@@ -412,6 +412,8 @@
   free(ai->explore.ocean);     ai->explore.ocean = NULL;
   free(ai->explore.continent); ai->explore.continent = NULL;
   free(ai->threats.continent); ai->threats.continent = NULL;
+  free(ai->threats.ocean);
+  ai->threats.ocean = NULL;
   free(ai->stats.workers);     ai->stats.workers = NULL;
   free(ai->stats.cities);      ai->stats.cities = NULL;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10612) aidata memory leak, Jason Short <=