Author: cazfi
Date: Tue Jan 20 23:32:49 2015
New Revision: 27751

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

See bug #23173

Modified:
    branches/S2_6/common/game.c
    branches/S2_6/common/research.c
    branches/S2_6/common/research.h

Modified: branches/S2_6/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/game.c?rev=27751&r1=27750&r2=27751&view=diff
==============================================================================
--- branches/S2_6/common/game.c (original)
+++ branches/S2_6/common/game.c Tue Jan 20 23:32:49 2015
@@ -474,6 +474,7 @@
   idex_free();
   team_slots_free();
   game_ruleset_free();
+  researches_free();
   cm_free();
 }
 

Modified: branches/S2_6/common/research.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/research.c?rev=27751&r1=27750&r2=27751&view=diff
==============================================================================
--- branches/S2_6/common/research.c     (original)
+++ branches/S2_6/common/research.c     Tue Jan 20 23:32:49 2015
@@ -52,6 +52,11 @@
 static struct name_translation advance_future_name = NAME_INIT;
 static struct name_translation advance_unknown_name = NAME_INIT;
 
+#define SPECVEC_TAG string
+#define SPECVEC_TYPE char *
+#include "specvec.h"
+
+static struct string_vector future;
 
 /****************************************************************************
   Initializes all player research structure.
@@ -81,6 +86,16 @@
   name_set(&advance_future_name, NULL, N_("Future Tech."));
   /* TRANS: "Unknown" advance/technology */
   name_set(&advance_unknown_name, NULL, N_("(Unknown)"));
+
+  string_vector_init(&future);
+}
+
+/****************************************************************************
+  Free all resources allocated for the research system
+****************************************************************************/
+void researches_free(void)
+{
+  string_vector_free(&future);
 }
 
 /****************************************************************************
@@ -168,10 +183,6 @@
 
   return fc_strlcpy(buf, nation_plural_for_player(pplayer), buf_len);
 }
-
-#define SPECVEC_TAG string
-#define SPECVEC_TYPE char *
-#include "specvec.h"
 
 /****************************************************************************
   Return the name translation for 'tech'. Utility for
@@ -204,7 +215,6 @@
                                        Tech_type_id tech)
 {
   if (A_FUTURE == tech && NULL != presearch) {
-    static struct string_vector future;
     const int no = presearch->future_tech;
     int i;
 
@@ -237,7 +247,6 @@
                                   Tech_type_id tech)
 {
   if (A_FUTURE == tech && NULL != presearch) {
-    static struct string_vector future;
     const int no = presearch->future_tech;
     int i;
 

Modified: branches/S2_6/common/research.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/research.h?rev=27751&r1=27750&r2=27751&view=diff
==============================================================================
--- branches/S2_6/common/research.h     (original)
+++ branches/S2_6/common/research.h     Tue Jan 20 23:32:49 2015
@@ -101,6 +101,7 @@
 
 /* Common functions. */
 void researches_init(void);
+void researches_free(void);
 
 int research_number(const struct research *presearch);
 const char *research_rule_name(const struct research *presearch);


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

Reply via email to