Author: cazfi
Date: Tue Jan 20 23:32:56 2015
New Revision: 27752

URL: http://svn.gna.org/viewcvs/freeciv?rev=27752&view=rev
Log:
Initialize and free future tech names strvec.

See bug #23173

Modified:
    branches/S2_5/common/tech.c

Modified: branches/S2_5/common/tech.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/tech.c?rev=27752&r1=27751&r2=27752&view=diff
==============================================================================
--- branches/S2_5/common/tech.c (original)
+++ branches/S2_5/common/tech.c Tue Jan 20 23:32:56 2015
@@ -49,6 +49,12 @@
 static double techcoststyle1[A_LAST];
 
 static struct user_flag user_tech_flags[MAX_NUM_USER_TECH_FLAGS];
+
+#define SPECVEC_TAG string
+#define SPECVEC_TYPE char *
+#include "specvec.h"
+
+static struct string_vector future;
 
 /**************************************************************************
   Return the last item of advances/technologies.
@@ -972,10 +978,6 @@
   return tech == A_FUTURE;
 }
 
-#define SPECVEC_TAG string
-#define SPECVEC_TYPE char *
-#include "specvec.h"
-
 /**************************************************************************
   Return the rule name of the given tech (including A_FUTURE). 
   You don't have to free the return pointer.
@@ -987,7 +989,6 @@
   /* We don't return a static buffer because that would break anything that
    * needed to work with more than one name at a time.
    * FIXME: The caller should provide a buffer to write that name. */
-  static struct string_vector future;
 
   switch (tech) {
   case A_FUTURE:
@@ -1031,7 +1032,6 @@
   /* We don't return a static buffer because that would break anything that
    * needed to work with more than one name at a time.
    * FIXME: The caller should provide a buffer to write that name. */
-  static struct string_vector future;
 
   switch (tech) {
   case A_FUTURE:
@@ -1205,6 +1205,8 @@
   /* Initialize dummy tech A_UNKNOWN */
   /* TRANS: "Unknown" advance/technology */
   name_set(&advances[A_UNKNOWN].name, NULL, N_("(Unknown)"));
+
+  string_vector_init(&future);
 }
 
 /***************************************************************
@@ -1233,4 +1235,6 @@
   advance_index_iterate(A_FIRST, i) {
     tech_free(i);
   } advance_index_iterate_end;
-}
+
+  string_vector_free(&future);
+}


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to