Author: cazfi
Date: Tue Jan 20 23:32:40 2015
New Revision: 27750

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

See bug #23173

Modified:
    trunk/common/game.c
    trunk/common/research.c
    trunk/common/research.h

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

Modified: trunk/common/research.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/research.c?rev=27750&r1=27749&r2=27750&view=diff
==============================================================================
--- trunk/common/research.c     (original)
+++ trunk/common/research.c     Tue Jan 20 23:32:40 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: trunk/common/research.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/research.h?rev=27750&r1=27749&r2=27750&view=diff
==============================================================================
--- trunk/common/research.h     (original)
+++ trunk/common/research.h     Tue Jan 20 23:32:40 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