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

On 07/08/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
>  Fix attached. section_file_read_dup() never release inf. Who ever
> allocates inf, always releases it.

 S2_0 version.


 - ML

diff -Nurd -X.diff_ignore freeciv/utility/registry.c freeciv/utility/registry.c
--- freeciv/utility/registry.c	2007-08-04 04:27:22.000000000 +0300
+++ freeciv/utility/registry.c	2007-08-08 00:55:18.000000000 +0300
@@ -562,9 +562,6 @@
     }
     exit(EXIT_FAILURE);
   }
-
-  inf_close(inf);
-  inf = NULL;
   
   astr_free(&base_name);
   astr_free(&entry_name);
@@ -586,11 +583,15 @@
 {
   char real_filename[1024];
   struct inputfile *inf;
+  bool success;
 
   interpret_tilde(real_filename, sizeof(real_filename), filename);
   inf = inf_from_file(real_filename, datafilename);
 
-  return section_file_read_dup(my_section_file, real_filename, inf, TRUE);
+  success = section_file_read_dup(my_section_file, real_filename, inf, TRUE);
+  inf_close(inf);
+
+  return success;
 }
 
 /**************************************************************************
@@ -601,11 +602,15 @@
 {
   char real_filename[1024];
   struct inputfile *inf;
+  bool success;
 
   interpret_tilde(real_filename, sizeof(real_filename), filename);
   inf = inf_from_file(real_filename, datafilename);
 
-  return section_file_read_dup(my_section_file, real_filename, inf, FALSE);
+  success = section_file_read_dup(my_section_file, real_filename, inf, FALSE);
+  inf_close(inf);
+
+  return success;
 }
 
 /**************************************************************************
@@ -615,8 +620,12 @@
 				   fz_FILE * stream)
 {
   struct inputfile *inf = inf_from_stream(stream, datafilename);
+  bool success;
 
-  return section_file_read_dup(my_section_file, NULL, inf, TRUE);
+  success = section_file_read_dup(my_section_file, NULL, inf, TRUE);
+  inf_close(inf);
+
+  return success;
 }
 
 /**************************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to