gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r2309 - in GNUnet: m4 src/util


From: grothoff
Subject: [GNUnet-SVN] r2309 - in GNUnet: m4 src/util
Date: Sun, 4 Dec 2005 23:06:34 -0800 (PST)

Author: grothoff
Date: 2005-12-04 23:06:30 -0800 (Sun, 04 Dec 2005)
New Revision: 2309

Modified:
   GNUnet/m4/Makefile.in
   GNUnet/src/util/initialize.c
   GNUnet/src/util/statuscalls.c
Log:
fixing tiny potential leak

Modified: GNUnet/m4/Makefile.in
===================================================================
--- GNUnet/m4/Makefile.in       2005-12-02 21:11:02 UTC (rev 2308)
+++ GNUnet/m4/Makefile.in       2005-12-05 07:06:30 UTC (rev 2309)
@@ -166,6 +166,8 @@
 STRIP = @STRIP@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
+XFREEBSD_FALSE = @XFREEBSD_FALSE@
+XFREEBSD_TRUE = @XFREEBSD_TRUE@
 XGETTEXT = @XGETTEXT@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_AS = @ac_ct_AS@

Modified: GNUnet/src/util/initialize.c
===================================================================
--- GNUnet/src/util/initialize.c        2005-12-02 21:11:02 UTC (rev 2308)
+++ GNUnet/src/util/initialize.c        2005-12-05 07:06:30 UTC (rev 2309)
@@ -173,6 +173,8 @@
   }
 }
 
+static int initStatus;
+
 /**
  * Initialize the util library. Use argc, argv and the given parser
  * for processing command-line options <strong>after</strong> the
@@ -209,19 +211,20 @@
   readConfiguration();
   setProcessPrio();
   initLogging();
-  if (testConfigurationString("GNUNETD",
-                             "_MAGIC_",
-                             "YES"))
+  initStatus = testConfigurationString("GNUNETD",
+                                      "_MAGIC_",
+                                      "YES");
+  if (initStatus)
     initStatusCalls();
   initState();
   return OK;
 }
 
 void doneUtil() {
-  if (testConfigurationString("GNUNETD",
-                             "_MAGIC_",
-                             "YES"))
+  if (initStatus) {
     doneStatusCalls();
+    initStatus = 0;
+  }
   doneCron();
   doneState();
   LOG(LOG_MESSAGE,

Modified: GNUnet/src/util/statuscalls.c
===================================================================
--- GNUnet/src/util/statuscalls.c       2005-12-02 21:11:02 UTC (rev 2308)
+++ GNUnet/src/util/statuscalls.c       2005-12-05 07:06:30 UTC (rev 2309)
@@ -844,16 +844,22 @@
 void doneStatusCalls() {
   int i;
 
+  if (initialized_ == NO)
+    return;
   unregisterConfigurationUpdateCallback(&resetStatusCalls);
   delCronJob(&cronLoadUpdate,
             10 * cronSECONDS,
             NULL);
   initialized_ = NO;
 #ifdef LINUX
-  if (proc_stat != NULL)
+  if (proc_stat != NULL) {
     fclose(proc_stat);
-  if (proc_net_dev != NULL)
+    proc_stat = NULL;
+  }
+  if (proc_net_dev != NULL) {
     fclose(proc_net_dev);
+    proc_net_dev = NULL;
+  }
 #endif
   for (i=0;i<ifcsSize;i++)
     FREE(ifcs[i].name);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]