Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#14064) CMA allocates timer several times
Home

[Freeciv-Dev] (PR#14064) CMA allocates timer several times

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#14064) CMA allocates timer several times
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Sep 2005 13:44:53 -0700
Reply-to: bugs@xxxxxxxxxxx

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

==11165== 64 bytes in 3 blocks are definitely lost in loss record 66 of 160
==11165==    at 0x1B8FF8A6: malloc (vg_replace_malloc.c:149)
==11165==    by 0x8081057: fc_real_malloc (mem.c:75)
==11165==    by 0x80865B5: renew_timer (timing.c:189)
==11165==    by 0x8086573: new_timer (timing.c:159)
==11165==    by 0x80E0447: cma_init (cma_core.c:487)
==11165==    by 0x80DF91E: agents_init (agents.c:347)
==11165==    by 0x805734D: set_client_state (civclient.c:517)
==11165==    by 0x80F5CF0: ui_main (gui_main.c:1179)
==11165==    by 0x8057A21: main (civclient.c:343)

Don't ask me how cma_init is called more than once.  But this patch 
should fix it.  This is in 2.0.

-jason

Index: client/agents/cma_core.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_core.c,v
retrieving revision 1.64.2.4
diff -p -u -r1.64.2.4 cma_core.c
--- client/agents/cma_core.c    26 Feb 2005 18:27:18 -0000      1.64.2.4
+++ client/agents/cma_core.c    20 Sep 2005 20:43:47 -0000
@@ -476,6 +476,7 @@ static void new_turn(void)
 void cma_init(void)
 {
   struct agent self;
+  struct timer *timer = stats.wall_timer;
 
   freelog(LOG_DEBUG, "sizeof(struct cm_result)=%d",
          (unsigned int) sizeof(struct cm_result));
@@ -484,7 +485,7 @@ void cma_init(void)
 
   /* reset cache counters */
   memset(&stats, 0, sizeof(stats));
-  stats.wall_timer = new_timer(TIMER_USER, TIMER_ACTIVE);
+  stats.wall_timer = renew_timer(timer, TIMER_USER, TIMER_ACTIVE);
 
   memset(&self, 0, sizeof(self));
   strcpy(self.name, "CMA");

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#14064) CMA allocates timer several times, Jason Short <=