gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8917 - GNUnet/src/applications/testing


From: gnunet
Subject: [GNUnet-SVN] r8917 - GNUnet/src/applications/testing
Date: Mon, 31 Aug 2009 16:02:02 -0600

Author: nevans
Date: 2009-08-31 16:02:01 -0600 (Mon, 31 Aug 2009)
New Revision: 8917

Modified:
   GNUnet/src/applications/testing/remote.c
Log:
leak memory fixes

Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c    2009-08-31 22:00:44 UTC (rev 
8916)
+++ GNUnet/src/applications/testing/remote.c    2009-08-31 22:02:01 UTC (rev 
8917)
@@ -244,7 +244,7 @@
   unsigned int is_local = 0;
   FILE *output;
   pid_t pid;
-
+  output = NULL;
   if (strcmp (daemon->hostname, "localhost") == 0)
     {
       is_local = 1;
@@ -254,7 +254,8 @@
     {
       length = snprintf (NULL, 0, "cat %s", daemon->pid);
       tempcmd = GNUNET_malloc (length + 1);
-      snprintf (tempcmd, length + 1, "cat %s", daemon->pid);
+      if (tempcmd != NULL)
+        snprintf (tempcmd, length + 1, "cat %s", daemon->pid);
     }
   else
     {
@@ -262,8 +263,9 @@
         snprintf (NULL, 0, "ssh address@hidden cat %s", daemon->username,
                   daemon->hostname, daemon->pid);
       tempcmd = GNUNET_malloc (length + 1);
-      snprintf (tempcmd, length + 1, "ssh address@hidden cat %s", 
daemon->username,
-                daemon->hostname, daemon->pid);
+      if (tempcmd != NULL)
+        snprintf (tempcmd, length + 1, "ssh address@hidden cat %s", 
daemon->username,
+                  daemon->hostname, daemon->pid);
     }
 #if VERBOSE
   fprintf (stderr, _("exec command is : %s \n"), tempcmd);
@@ -706,6 +708,7 @@
               GNUNET_free (temp_path);
               GNUNET_free (temp_remote_config_path);
               GNUNET_free (temp_host_string);
+              GNUNET_free (temp_pid_file);
               break;
             }
           CLOSE (ret);
@@ -714,6 +717,7 @@
               GNUNET_free (temp_path);
               GNUNET_free (temp_remote_config_path);
               GNUNET_free (temp_host_string);
+              GNUNET_free (temp_pid_file);
               break;
             }
 
@@ -979,6 +983,7 @@
                                                GNUNET_GE_USER |
                                                GNUNET_GE_BULK, "mkstemp",
                                                temp_path);
+                  GNUNET_free (temp_pid_file);
                   GNUNET_free (temp_path);
                   GNUNET_free (temp_remote_config_path);
                   GNUNET_free (temp_host_string);
@@ -987,6 +992,7 @@
               CLOSE (ret);
               if (0 != GNUNET_GC_write_configuration (basecfg, temp_path))
                 {
+                  GNUNET_free (temp_pid_file);
                   GNUNET_free (temp_path);
                   GNUNET_free (temp_remote_config_path);
                   GNUNET_free (temp_host_string);
@@ -1089,7 +1095,6 @@
   GNUNET_free (mysql_password);
   GNUNET_free (mysql_server);
   GNUNET_free (logNModifier_string);
-
   *ret_peers = new_ret_peers;
   return ret;
 }
@@ -1110,7 +1115,8 @@
 
   tempEntry = NULL;
   tempFriendEntry = NULL;
-
+  pid1 = 0;
+  pid2 = 0;
   GNUNET_mutex_lock (connectMutex);
 #if VERBOSE
   fprintf (stdout, "Starting thread %d\n", threadCount);
@@ -1140,6 +1146,9 @@
         }
       GNUNET_mutex_unlock (connectMutex);
 
+      pid1 = pos->pid;
+      pid2 = friend_pos->hostentry->pid;
+
       if (match == GNUNET_YES)
         {
 #if VERBOSE
@@ -1154,8 +1163,6 @@
           continue;
         }
 
-      pid1 = pos->pid;
-      pid2 = friend_pos->hostentry->pid;
 #if VERBOSE
       fprintf (stderr,
                _
@@ -1289,6 +1296,7 @@
                                               head, dotOutFile);
       break;
     case GNUNET_REMOTE_NONE:
+      GNUNET_free (daemon_list);
       return ret;
       break;
     default:
@@ -1372,7 +1380,7 @@
       tempThreadCount = 0;
       for (j = 0; j < number_of_daemons; j++)
         {
-          if (tempThreadCount > MAX_CONNECT_THREADS)
+          if (tempThreadCount >= MAX_CONNECT_THREADS)
             {
               for (i = 0; i < tempThreadCount; i++)
                 {
@@ -1422,7 +1430,10 @@
   if (ret != GNUNET_OK)
     return ret;
   else
-    return totalConnections;
+    {
+      GNUNET_free (daemon_list);
+      return totalConnections;
+    }
 }
 
 /* end of remote.c */





reply via email to

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