tIt should now be possible to call InitConfiguration() multiple times without causing memory leaks. - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 9a05b1cdb66220150503ebe76b734858e573e3d2
 (DIR) parent 987ee05bceb1689433a117983b4f7ca4f19f04d6
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Mon, 12 Aug 2002 11:37:55 +0000
       
       It should now be possible to call InitConfiguration() multiple times without
       causing memory leaks.
       
       
       Diffstat:
         M src/dopewars.c                      |      24 +++++++++++-------------
         M src/message.c                       |       2 +-
         M src/serverside.c                    |       2 +-
       
       3 files changed, 13 insertions(+), 15 deletions(-)
       ---
 (DIR) diff --git a/src/dopewars.c b/src/dopewars.c
       t@@ -80,7 +80,7 @@ gboolean Network, Client, Server, WantAntique = FALSE;
         */
        unsigned Port = 7902;
        gboolean Sanitized, ConfigVerbose, DrugValue, Antique = FALSE;
       -gchar *HiScoreFile = NULL, *ServerName = NULL, *ConvertFile = NULL;
       +gchar *HiScoreFile = NULL, *ServerName = NULL;
        gchar *ServerMOTD = NULL, *BindAddress = NULL;
        
        struct DATE StartDate = {
       t@@ -191,7 +191,9 @@ struct NAMES DefaultNames = {
          N_("Dan\'s House of Guns"), N_("the pub")
        };
        
       -struct CURRENCY Currency;
       +struct CURRENCY Currency = {
       +  NULL, TRUE
       +};
        
        struct PRICES Prices = {
          20000, 10000
       t@@ -2363,21 +2365,11 @@ static void SetupParameters(GSList *extraconfigs)
          GSList *list;
          int i;
        
       -  /* Initialise variables */
       -  srand((unsigned)time(NULL));
       -  PidFile = NULL;
       -  ConvertFile = NULL;
       -  Location = NULL;
       -  Gun = NULL;
       -  Drug = NULL;
       -  SubwaySaying = Playing = StoppedTo = NULL;
          DrugValue = TRUE;
          Sanitized = ConfigVerbose = FALSE;
       -  NumLocation = NumGun = NumDrug = 0;
       -  FirstClient = FirstServer = NULL;
       -  Noone.Name = g_strdup("Noone");
          Server = Client = Network = FALSE;
        
       +  g_free(Currency.Symbol);
          /* The currency symbol */
          Currency.Symbol = g_strdup(_("$"));
          Currency.Prefix = (strcmp("Currency.Prefix=TRUE",
       t@@ -2403,6 +2395,9 @@ static void SetupParameters(GSList *extraconfigs)
          AssignName(&Socks.name, "socks");
          Socks.port = 1080;
          Socks.version = 4;
       +  g_free(Socks.user);
       +  g_free(Socks.authuser);
       +  g_free(Socks.authpassword);
          Socks.user = g_strdup("");
          Socks.numuid = FALSE;
          Socks.authuser = g_strdup("");
       t@@ -2725,9 +2720,12 @@ struct CMDLINE *GeneralStartup(int argc, char *argv[])
          OpenHighScoreFile();
          DropPrivileges();
        
       +  /* Initialise variables */
          Log.File = g_strdup("");
          Log.Level = 2;
          Log.Timestamp = g_strdup("[%H:%M:%S] ");
       +  srand((unsigned)time(NULL));
       +  Noone.Name = g_strdup("Noone");
        
          return ParseCmdLine(argc, argv);
        }
 (DIR) diff --git a/src/message.c b/src/message.c
       t@@ -100,7 +100,7 @@
           and vice versa.  */
        /* *INDENT-ON* */
        
       -GSList *FirstClient;
       +GSList *FirstClient = NULL;
        
        static Converter *netconv = NULL;
        
 (DIR) diff --git a/src/serverside.c b/src/serverside.c
       t@@ -114,7 +114,7 @@ HttpConnection *MetaConn = NULL;
        static FILE *ScoreFP = NULL;
        
        /* Pointer to the filename of a pid file (if non-NULL) */
       -char *PidFile;
       +char *PidFile = NULL;
        
        static char HelpText[] = {
          /* Help on various general server commands */