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

[Freeciv-Dev] Re: (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] Re: (PR#14191) more 2.0 tilespec leaks
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 4 Oct 2005 16:35:20 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Oops, it happens in the development version too.  Here's a patch.  I 
will commit them both immediately.

-jason


Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.328
diff -p -u -r1.328 tilespec.c
--- client/tilespec.c   4 Oct 2005 16:46:12 -0000       1.328
+++ client/tilespec.c   4 Oct 2005 23:33:37 -0000
@@ -1227,12 +1227,16 @@ struct tileset *tileset_read_toplevel(co
 
   if (!section_file_load(file, fname)) {
     freelog(LOG_ERROR, _("Could not open \"%s\"."), fname);
+    section_file_free(file);
+    free(fname);
     tileset_free(t);
     return NULL;
   }
 
   if (!check_tilespec_capabilities(file, "tilespec",
                                   TILESPEC_CAPSTR, fname)) {
+    section_file_free(file);
+    free(fname);
     tileset_free(t);
     return NULL;
   }
@@ -1385,6 +1389,8 @@ struct tileset *tileset_read_toplevel(co
   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);
     tileset_free(t);
     return NULL;
   }
@@ -1504,6 +1510,8 @@ struct tileset *tileset_read_toplevel(co
     if (!hash_insert(t->terrain_hash, terr->name, terr)) {
       freelog(LOG_NORMAL, "warning: duplicate terrain entry %s.",
              terrains[i]);
+      section_file_free(file);
+      free(fname);
       tileset_free(t);
       return NULL;
     }
@@ -1515,6 +1523,8 @@ struct tileset *tileset_read_toplevel(co
                                          "tilespec.files");
   if (num_spec_files == 0) {
     freelog(LOG_ERROR, "No tile files specified in \"%s\"", fname);
+    section_file_free(file);
+    free(fname);
     tileset_free(t);
     return NULL;
   }
@@ -1530,6 +1540,8 @@ struct tileset *tileset_read_toplevel(co
     sf->big_sprite = NULL;
     dname = datafilename(spec_filenames[i]);
     if (!dname) {
+      section_file_free(file);
+      free(fname);
       tileset_free(t);
       return NULL;
     }

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