Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10665) memory leak in cities.ruleset loading
Home

[Freeciv-Dev] (PR#10665) memory leak in cities.ruleset loading

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10665) memory leak in cities.ruleset loading
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Oct 2004 10:31:36 -0700
Reply-to: rt@xxxxxxxxxxx

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

==4563== 3412 bytes in 197 blocks are definitely lost in loss record 13 
of 16
==4563==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
==4563==    by 0x804B512: fc_real_malloc (mem.c:79)
==4563==    by 0x80B2AAE: secfile_lookup_str_vec (registry.c:1481)
==4563==    by 0x808CCAD: load_ruleset_cities (ruleset.c:2545)
==4563==    by 0x808F0FA: load_rulesets (ruleset.c:3223)
==4563==    by 0x8051E5F: srv_loop (srv_main.c:1695)
==4563==    by 0x8051D4B: srv_main (srv_main.c:1647)
==4563==    by 0x804A94E: main (civserver.c:170)

The value is allocated but never freed...simple enough.  17 bytes per 
entry is a little odd.  But what's really odd is that this function 
appears to be called 197 times.  This looks impossible from the code so 
I guess I'll just assume valgrind is wrong.

jason

Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.196
diff -u -r1.196 ruleset.c
--- server/ruleset.c    25 Sep 2004 22:18:42 -0000      1.196
+++ server/ruleset.c    21 Oct 2004 17:31:15 -0000
@@ -2559,6 +2559,7 @@
       = secfile_lookup_int(file, "specialist.%s_base_bonus", name);
     
   }
+  free(specialist_names);
 
   game.rgame.changable_tax = 
     secfile_lookup_bool_default(file, TRUE, "specialist.changable_tax");

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10665) memory leak in cities.ruleset loading, Jason Short <=