gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15996 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r15996 - gnunet/src/testing
Date: Fri, 15 Jul 2011 13:10:45 +0200

Author: grothoff
Date: 2011-07-15 13:10:44 +0200 (Fri, 15 Jul 2011)
New Revision: 15996

Modified:
   gnunet/src/testing/testing_group.c
Log:
leak

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2011-07-15 11:09:07 UTC (rev 15995)
+++ gnunet/src/testing/testing_group.c  2011-07-15 11:10:44 UTC (rev 15996)
@@ -2568,79 +2568,80 @@
 
       switch (curr_state)
         {
-      case NUM_PEERS:
-        errno = 0;
-        total_peers = strtoul(&buf[count], NULL, 10);
-        if (errno != 0)
-          {
-            GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                        "Failed to read number of peers from topology 
file!\n");
-            GNUNET_free_non_null(data);
-            return connect_attempts;
-          }
-        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                    "Read %u total peers in topology\n", total_peers);
-        GNUNET_assert(total_peers == pg->total);
-        curr_state = PEER_INDEX;
-        while ((buf[count] != '\n') && (count < frstat.st_size - 1))
-          count++;
-        count++;
-        break;
-      case PEER_INDEX:
-        errno = 0;
-        first_peer_index = strtoul(&buf[count], NULL, 10);
-        if (errno != 0)
-          {
-            GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                        "Failed to read peer index from topology file!\n");
-            GNUNET_free_non_null(data);
-            return connect_attempts;
-          }
-        while ((buf[count] != ':') && (count < frstat.st_size - 1))
-          count++;
-        count++;
-        curr_state = OTHER_PEER_INDEX;
-        break;
-      case COLON:
-        if (1 == sscanf (&buf[count], ":"))
-          curr_state = OTHER_PEER_INDEX;
-        count++;
-        break;
-      case OTHER_PEER_INDEX:
-        errno = 0;
-        second_peer_index = strtoul(&buf[count], NULL, 10);
-        if (errno != 0)
-          {
-            GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                        "Failed to peer index from topology file!\n");
-            GNUNET_free_non_null(data);
-            return connect_attempts;
-          }
-        /* Assume file is written with first peer 1, but array index is 0 */
-        connect_attempts += proc (pg, first_peer_index - 1, second_peer_index
-                                  - 1, list, GNUNET_YES);
-        while ((buf[count] != '\n') && (buf[count] != ',') && (count
-            < frstat.st_size - 1))
-          count++;
-        if (buf[count] == '\n')
-          {
-            curr_state = PEER_INDEX;
-          }
-        else if (buf[count] != ',')
-          {
-            curr_state = OTHER_PEER_INDEX;
-          }
-        count++;
-        break;
-      default:
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                    "Found bad data in topology file while in state %d!\n",
-                    curr_state);
-        GNUNET_break(0);
-        return connect_attempts;
+       case NUM_PEERS:
+         errno = 0;
+         total_peers = strtoul(&buf[count], NULL, 10);
+         if (errno != 0)
+           {
+             GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                         "Failed to read number of peers from topology 
file!\n");
+             GNUNET_free (data);
+             return connect_attempts;
+           }
+         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                     "Read %u total peers in topology\n", total_peers);
+         GNUNET_assert(total_peers == pg->total);
+         curr_state = PEER_INDEX;
+         while ((buf[count] != '\n') && (count < frstat.st_size - 1))
+           count++;
+         count++;
+         break;
+       case PEER_INDEX:
+         errno = 0;
+         first_peer_index = strtoul(&buf[count], NULL, 10);
+         if (errno != 0)
+           {
+             GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                         "Failed to read peer index from topology file!\n");
+             GNUNET_free (data);
+             return connect_attempts;
+           }
+         while ((buf[count] != ':') && (count < frstat.st_size - 1))
+           count++;
+         count++;
+         curr_state = OTHER_PEER_INDEX;
+         break;
+       case COLON:
+         if (1 == sscanf (&buf[count], ":"))
+           curr_state = OTHER_PEER_INDEX;
+         count++;
+         break;
+       case OTHER_PEER_INDEX:
+         errno = 0;
+         second_peer_index = strtoul(&buf[count], NULL, 10);
+         if (errno != 0)
+           {
+             GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                         "Failed to peer index from topology file!\n");
+             GNUNET_free (data);
+             return connect_attempts;
+           }
+         /* Assume file is written with first peer 1, but array index is 0 */
+         connect_attempts += proc (pg, first_peer_index - 1, second_peer_index
+                                   - 1, list, GNUNET_YES);
+         while ((buf[count] != '\n') && (buf[count] != ',') && (count
+                                                                < 
frstat.st_size - 1))
+           count++;
+         if (buf[count] == '\n')
+           {
+             curr_state = PEER_INDEX;
+           }
+         else if (buf[count] != ',')
+           {
+             curr_state = OTHER_PEER_INDEX;
+           }
+         count++;
+         break;
+       default:
+         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                     "Found bad data in topology file while in state %d!\n",
+                     curr_state);
+         GNUNET_break(0);
+         GNUNET_free (data);
+         return connect_attempts;
         }
-
     }
+  GNUNET_free (data);
   return connect_attempts;
 }
 




reply via email to

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