Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#14191) more 2.0 tilespec leaks
Home

[Freeciv-Dev] (PR#14191) more 2.0 tilespec leaks

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#14191) more 2.0 tilespec leaks
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 4 Oct 2005 16:17:50 -0700
Reply-to: bugs@xxxxxxxxxxx

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

These leaks should only affact 2.0 I think.  It only happens when a 
tileset fails to load.

-jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.204.2.18
diff -p -u -r1.204.2.18 tilespec.c
--- client/tilespec.c   1 Mar 2005 21:46:46 -0000       1.204.2.18
+++ client/tilespec.c   4 Oct 2005 23:16:37 -0000
@@ -762,12 +762,15 @@ bool tilespec_read_toplevel(const char *
   freelog(LOG_VERBOSE, "tilespec file is %s", fname);
 
   if (!section_file_load(file, fname)) {
+    free(fname);
     freelog(LOG_ERROR, _("Could not open \"%s\"."), fname);
     return FALSE;
   }
 
   if (!check_tilespec_capabilities(file, "tilespec",
                                   TILESPEC_CAPSTR, fname)) {
+    section_file_free(file);
+    free(fname);
     return FALSE;
   }
 
@@ -903,6 +906,8 @@ bool tilespec_read_toplevel(const char *
   terrains = secfile_get_secnames_prefix(file, "terrain_", &num_terrains);
   if (num_terrains == 0) {
     freelog(LOG_ERROR, "No terrain types supported by tileset.");
+    section_file_free(file);
+    free(fname);
     return FALSE;
   }
 
@@ -1021,6 +1026,8 @@ bool tilespec_read_toplevel(const char *
     if (!hash_insert(terrain_hash, terr->name, terr)) {
       freelog(LOG_NORMAL, "warning: duplicate terrain entry %s.",
              terrains[i]);
+      section_file_free(file);
+      free(fname);
       return FALSE;
     }
   }
@@ -1031,6 +1038,8 @@ bool tilespec_read_toplevel(const char *
                                          "tilespec.files");
   if (num_spec_files == 0) {
     freelog(LOG_ERROR, "No tile files specified in \"%s\"", fname);
+    section_file_free(file);
+    free(fname);
     return FALSE;
   }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#14191) more 2.0 tilespec leaks, Jason Short <=