Author: cazfi
Date: Tue Jan 20 23:33:03 2015
New Revision: 27753

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

See bug #23173

Modified:
    branches/S2_4/common/tech.c

Modified: branches/S2_4/common/tech.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/common/tech.c?rev=27753&r1=27752&r2=27753&view=diff
==============================================================================
--- branches/S2_4/common/tech.c (original)
+++ branches/S2_4/common/tech.c Tue Jan 20 23:33:03 2015
@@ -47,6 +47,12 @@
 /* Precalculated costs according to techcost style 1.  These do not include
  * the sciencebox multiplier. */
 static double techcoststyle1[A_LAST];
+
+#define SPECVEC_TAG string
+#define SPECVEC_TYPE char *
+#include "specvec.h"
+
+static struct string_vector future;
 
 /**************************************************************************
   Return the last item of advances/technologies.
@@ -957,10 +963,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.
@@ -972,7 +974,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:
@@ -1016,7 +1017,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:
@@ -1115,6 +1115,8 @@
   /* Initialize dummy tech A_UNKNOWN */
   /* TRANS: "Unknown" advance/technology */
   name_set(&advances[A_UNKNOWN].name, N_("(Unknown)"));
+
+  string_vector_init(&future);
 }
 
 /***************************************************************
@@ -1143,4 +1145,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