gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37468 - in gnunet/src: arm ats ats-tests conversation data


From: gnunet
Subject: [GNUnet-SVN] r37468 - in gnunet/src: arm ats ats-tests conversation datastore gnsrecord nse regex set testbed testbed-logger util
Date: Wed, 6 Jul 2016 17:24:27 +0200

Author: grothoff
Date: 2016-07-06 17:24:26 +0200 (Wed, 06 Jul 2016)
New Revision: 37468

Modified:
   gnunet/src/arm/gnunet-service-arm.c
   gnunet/src/ats-tests/ats-testing-log.c
   gnunet/src/ats-tests/gnunet-ats-sim.c
   gnunet/src/ats-tests/perf_ats.c
   gnunet/src/ats/ats_api_scheduling.c
   gnunet/src/conversation/conversation.h
   gnunet/src/conversation/conversation_api.c
   gnunet/src/conversation/gnunet-service-conversation.c
   gnunet/src/datastore/gnunet-service-datastore.c
   gnunet/src/datastore/plugin_datastore_mysql.c
   gnunet/src/gnsrecord/plugin_gnsrecord_dns.c
   gnunet/src/nse/perf_kdf.c
   gnunet/src/regex/regex_internal.c
   gnunet/src/set/gnunet-service-set_union.c
   gnunet/src/testbed-logger/testbed_logger_api.c
   gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c
   gnunet/src/util/test_container_multihashmap.c
   gnunet/src/util/test_container_multipeermap.c
Log:
misc fixes

Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2016-07-06 13:25:24 UTC (rev 37467)
+++ gnunet/src/arm/gnunet-service-arm.c 2016-07-06 15:24:26 UTC (rev 37468)
@@ -464,17 +464,17 @@
     fin_options = GNUNET_strdup (final_option);
     /* replace '{}' with service name */
     while (NULL != (optpos = strstr (fin_options, "{}")))
-      {
-        /* terminate string at opening parenthesis */
-        *optpos = 0;
-        GNUNET_asprintf (&new_options,
-                         "%s%s%s",
-                         fin_options,
-                         sl->name,
-                         optpos + 2);
-        GNUNET_free (fin_options);
-        fin_options = new_options;
-      }
+    {
+      /* terminate string at opening parenthesis */
+      *optpos = 0;
+      GNUNET_asprintf (&new_options,
+                       "%s%s%s",
+                       fin_options,
+                       sl->name,
+                       optpos + 2);
+      GNUNET_free (fin_options);
+      fin_options = new_options;
+    }
     if (NULL != options)
     {
       /* combine "fin_options" with "options" */

Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2016-07-06 13:25:24 UTC (rev 37467)
+++ gnunet/src/ats/ats_api_scheduling.c 2016-07-06 15:24:26 UTC (rev 37468)
@@ -253,6 +253,7 @@
   static uint32_t off;
   uint32_t i;
 
+  GNUNET_assert (0 != sh->session_array_size);
   i = 0;
   while ( ( (NOT_FOUND == off) ||
             (NULL != sh->session_array[off % sh->session_array_size]) ) &&

Modified: gnunet/src/ats-tests/ats-testing-log.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-log.c      2016-07-06 13:25:24 UTC (rev 
37467)
+++ gnunet/src/ats-tests/ats-testing-log.c      2016-07-06 15:24:26 UTC (rev 
37468)
@@ -693,7 +693,7 @@
      else
      {
        mlt->total_throughput_send = mult * mlt->total_bytes_sent;
-       mlt->total_throughput_send = mult * mlt->total_bytes_received;
+       mlt->total_throughput_recv = mult * mlt->total_bytes_received;
      }
 
     if (GNUNET_YES == l->verbose)

Modified: gnunet/src/ats-tests/gnunet-ats-sim.c
===================================================================
--- gnunet/src/ats-tests/gnunet-ats-sim.c       2016-07-06 13:25:24 UTC (rev 
37467)
+++ gnunet/src/ats-tests/gnunet-ats-sim.c       2016-07-06 15:24:26 UTC (rev 
37468)
@@ -57,11 +57,13 @@
  */
 static int opt_verbose;
 
-struct GNUNET_SCHEDULER_Task * timeout_task;
+static struct GNUNET_SCHEDULER_Task *timeout_task;
 
-struct Experiment *e;
-struct LoggingHandle *l;
+static struct Experiment *e;
 
+static struct LoggingHandle *l;
+
+
 static void
 evaluate (struct GNUNET_TIME_Relative duration_total)
 {
@@ -125,11 +127,16 @@
   }
 }
 
+
 static void
-do_shutdown ()
+do_shutdown (void *cls)
 {
   fprintf (stderr, "Shutdown\n");
-  /* timeout */
+  if (NULL != timeout_task)
+  {
+    GNUNET_SCHEDULER_cancel (timeout_task);
+    timeout_task = NULL;
+  }
   if (NULL != l)
   {
     GNUNET_ATS_TEST_logging_stop (l);
@@ -153,9 +160,17 @@
 
 
 static void
+do_timeout (void *cls)
+{
+  timeout_task = NULL;
+  GNUNET_SCHEDULER_shutdown ();
+}
+
+
+static void
 transport_recv_cb (void *cls,
-                   const struct GNUNET_PeerIdentity * peer,
-                   const struct GNUNET_MessageHeader * message)
+                   const struct GNUNET_PeerIdentity *peer,
+                   const struct GNUNET_MessageHeader *message)
 {
 
 }
@@ -175,19 +190,19 @@
 
 }
 
+
 static void
-experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative 
duration,int success)
+experiment_done_cb (struct Experiment *e,
+                    struct GNUNET_TIME_Relative duration,int success)
 {
   if (GNUNET_OK == success)
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment done successful in %s\n",
-        GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Experiment done successful in %s\n",
+                GNUNET_STRINGS_relative_time_to_string (duration,
+                                                        GNUNET_YES));
   else
     GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n");
-  if (NULL != timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_task);
-    timeout_task = NULL;
-  }
+
   /* Stop logging */
   GNUNET_ATS_TEST_logging_stop (l);
 
@@ -200,22 +215,10 @@
   evaluate (duration);
   if (opt_log)
     GNUNET_ATS_TEST_logging_write_to_file(l, opt_exp_file, opt_plot);
+  GNUNET_SCHEDULER_shutdown ();
+}
 
-  if (NULL != l)
-  {
-    GNUNET_ATS_TEST_logging_stop (l);
-    GNUNET_ATS_TEST_logging_clean_up (l);
-    l = NULL;
-  }
 
-  /* Clean up experiment */
-  GNUNET_ATS_TEST_experimentation_stop (e);
-  e = NULL;
-
-  /* Shutdown topology */
-  GNUNET_ATS_TEST_shutdown_topology ();
-}
-
 static void
 episode_done_cb (struct Episode *ep)
 {
@@ -222,9 +225,10 @@
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Episode %u done\n", ep->id);
 }
 
+
 static void topology_setup_done (void *cls,
-    struct BenchmarkPeer *masters,
-    struct BenchmarkPeer *slaves)
+                                 struct BenchmarkPeer *masters,
+                                 struct BenchmarkPeer *slaves)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Topology setup complete!\n");
 
@@ -309,10 +313,15 @@
   }
 #endif
 
-  timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 
(GNUNET_TIME_UNIT_MINUTES,
-      e->max_duration), &do_shutdown, NULL);
+  timeout_task
+    = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 
(GNUNET_TIME_UNIT_MINUTES,
+                                                              e->max_duration),
+                                    &do_timeout,
+                                    NULL);
+  GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
 }
 
+
 static void
 parse_args (int argc, char *argv[])
 {
@@ -325,6 +334,7 @@
   {
     if ((c < (argc - 1)) && (0 == strcmp (argv[c], "-e")))
     {
+      GNUNET_free_non_null (opt_exp_file);
       opt_exp_file = GNUNET_strdup ( argv[c + 1]);
     }
     if (0 == strcmp (argv[c], "-l"))
@@ -342,6 +352,7 @@
   }
 }
 
+
 int
 main (int argc, char *argv[])
 {

Modified: gnunet/src/ats-tests/perf_ats.c
===================================================================
--- gnunet/src/ats-tests/perf_ats.c     2016-07-06 13:25:24 UTC (rev 37467)
+++ gnunet/src/ats-tests/perf_ats.c     2016-07-06 15:24:26 UTC (rev 37468)
@@ -137,14 +137,12 @@
   double kb_recv_percent;
   unsigned int rtt;
 
-  duration = (perf_duration.rel_value_us / (1000 * 1000));
+  duration = 1 + (perf_duration.rel_value_us / (1000 * 1000));
   for (c_m = 0; c_m < num_masters; c_m++)
   {
     mp = &mps[c_m];
-    if (NULL == mp)
-      continue;
     fprintf (stderr,
-        _("Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB 
in %u sec. = %u KiB/s\n"),
+             "Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u 
KiB in %u sec. = %u KiB/s\n",
         mp->no, mp->total_bytes_sent / 1024, duration,
         (mp->total_bytes_sent / 1024) / duration,
         mp->total_bytes_received / 1024, duration,
@@ -153,8 +151,6 @@
     for (c_s = 0; c_s < num_slaves; c_s++)
     {
       p = &mp->partners[c_s];
-      if (NULL == p)
-        continue;
       kb_sent_sec = 0;
       kb_recv_sec = 0;
       kb_sent_percent = 0.0;

Modified: gnunet/src/conversation/conversation.h
===================================================================
--- gnunet/src/conversation/conversation.h      2016-07-06 13:25:24 UTC (rev 
37467)
+++ gnunet/src/conversation/conversation.h      2016-07-06 15:24:26 UTC (rev 
37468)
@@ -40,6 +40,14 @@
 
 
 /**
+ * Highest bit in a 32-bit unsigned integer,
+ * bit set if we are making an outgoing call,
+ * bit unset for local lines.
+ */
+#define HIGH_BIT ((uint32_t) (1LL << 31))
+
+
+/**
  * Message to transmit the audio (between client and helpers).
  */
 struct AudioMessage

Modified: gnunet/src/conversation/conversation_api.c
===================================================================
--- gnunet/src/conversation/conversation_api.c  2016-07-06 13:25:24 UTC (rev 
37467)
+++ gnunet/src/conversation/conversation_api.c  2016-07-06 15:24:26 UTC (rev 
37468)
@@ -609,7 +609,7 @@
                                "LINE");
     return NULL;
   }
-  if (line >= (1 << 31))
+  if (line >= HIGH_BIT)
   {
     GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
                                "CONVERSATION",

Modified: gnunet/src/conversation/gnunet-service-conversation.c
===================================================================
--- gnunet/src/conversation/gnunet-service-conversation.c       2016-07-06 
13:25:24 UTC (rev 37467)
+++ gnunet/src/conversation/gnunet-service-conversation.c       2016-07-06 
15:24:26 UTC (rev 37468)
@@ -285,7 +285,7 @@
   GNUNET_CONTAINER_DLL_insert (lines_head,
                                lines_tail,
                                line);
-  line->local_line = ntohl (msg->line) & (~ (1 << 31));
+  line->local_line = ntohl (msg->line) & (~ HIGH_BIT);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
@@ -703,7 +703,7 @@
   }
   line = GNUNET_new (struct Line);
   line->client = client;
-  line->local_line = (local_line_cnt++) | (1 << 31);
+  line->local_line = (local_line_cnt++) | HIGH_BIT;
   GNUNET_SERVER_client_set_user_context (client, line);
   GNUNET_SERVER_notification_context_add (nc, client);
   GNUNET_CONTAINER_DLL_insert (lines_head,

Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c     2016-07-06 13:25:24 UTC 
(rev 37467)
+++ gnunet/src/datastore/gnunet-service-datastore.c     2016-07-06 15:24:26 UTC 
(rev 37468)
@@ -37,6 +37,11 @@
 #define MAX_PENDING 1024
 
 /**
+ * Limit size of bloom filter to 2 GB.
+ */
+#define MAX_BF_SIZE ((uint32_t) (1LL << 31))
+
+/**
  * How long are we at most keeping "expired" content
  * past the expiration date in the database?
  */
@@ -184,7 +189,7 @@
  * Identity of the task that is used to delete
  * expired content.
  */
-static struct GNUNET_SCHEDULER_Task * expired_kill_task;
+static struct GNUNET_SCHEDULER_Task *expired_kill_task;
 
 /**
  * Minimum time that content should have to not be discarded instantly
@@ -537,7 +542,8 @@
  * @param msg message to transmit, will be freed!
  */
 static void
-transmit (struct GNUNET_SERVER_Client *client, struct GNUNET_MessageHeader 
*msg)
+transmit (struct GNUNET_SERVER_Client *client,
+          struct GNUNET_MessageHeader *msg)
 {
   struct TransmitCallbackContext *tcc;
 
@@ -611,14 +617,18 @@
  * @param expiration expiration time for the content
  * @param uid unique identifier for the datum;
  *        maybe 0 if no unique identifier is available
- *
- * @return GNUNET_SYSERR to abort the iteration, GNUNET_OK to continue,
- *         GNUNET_NO to delete the item and continue (if supported)
+ * @return #GNUNET_SYSERR to abort the iteration, #GNUNET_OK to continue,
+ *         #GNUNET_NO to delete the item and continue (if supported)
  */
 static int
-transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
-               const void *data, enum GNUNET_BLOCK_Type type, uint32_t 
priority,
-               uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
+transmit_item (void *cls,
+               const struct GNUNET_HashCode *key,
+               uint32_t size,
+               const void *data,
+               enum GNUNET_BLOCK_Type type,
+               uint32_t priority,
+               uint32_t anonymity,
+               struct GNUNET_TIME_Absolute expiration,
                uint64_t uid)
 {
   struct GNUNET_SERVER_Client *client = cls;
@@ -1798,12 +1808,17 @@
     return;
   }
   stats = GNUNET_STATISTICS_create ("datastore", cfg);
-  GNUNET_STATISTICS_set (stats, gettext_noop ("# quota"), quota, GNUNET_NO);
+  GNUNET_STATISTICS_set (stats,
+                         gettext_noop ("# quota"),
+                         quota,
+                         GNUNET_NO);
   cache_size = quota / 8;       /* Or should we make this an option? */
-  GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size,
+  GNUNET_STATISTICS_set (stats,
+                         gettext_noop ("# cache size"),
+                         cache_size,
                          GNUNET_NO);
-  if (quota / (32 * 1024LL) > (1 << 31))
-    bf_size = (1 << 31);          /* absolute limit: ~2 GB, beyond that BF 
just won't help anyway */
+  if (quota / (32 * 1024LL) > MAX_BF_SIZE)
+    bf_size = MAX_BF_SIZE;
   else
     bf_size = quota / (32 * 1024LL);         /* 8 bit per entry, 1 bit per 32 
kb in DB */
   fn = NULL;

Modified: gnunet/src/datastore/plugin_datastore_mysql.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_mysql.c       2016-07-06 13:25:24 UTC 
(rev 37467)
+++ gnunet/src/datastore/plugin_datastore_mysql.c       2016-07-06 15:24:26 UTC 
(rev 37468)
@@ -990,6 +990,7 @@
     proc (proc_cls, NULL, 0);
     return;
   }
+  memset (&last, 0, sizeof (last)); /* make static analysis happy */
   ret = GNUNET_YES;
   cnt = 0;
   while (ret == GNUNET_YES)

Modified: gnunet/src/gnsrecord/plugin_gnsrecord_dns.c
===================================================================
--- gnunet/src/gnsrecord/plugin_gnsrecord_dns.c 2016-07-06 13:25:24 UTC (rev 
37467)
+++ gnunet/src/gnsrecord/plugin_gnsrecord_dns.c 2016-07-06 15:24:26 UTC (rev 
37468)
@@ -265,7 +265,7 @@
  * @return the value, 0 if not found
  */
 static unsigned int
-rfc4394_mnemonic_to_value (const char *mnemonic)
+rfc4398_mnemonic_to_value (const char *mnemonic)
 {
   static struct {
     const char *mnemonic;
@@ -425,7 +425,7 @@
       sdup = GNUNET_strdup (s);
       typep = strtok (sdup, " ");
       if ( (NULL == typep) ||
-           ( (0 == (type = rfc4394_mnemonic_to_value (typep))) &&
+           ( (0 == (type = rfc4398_mnemonic_to_value (typep))) &&
              ( (1 != SSCANF (typep,
                              "%u",
                              &type)) ||
@@ -444,6 +444,7 @@
         GNUNET_free (sdup);
         return GNUNET_SYSERR;
       }
+      alg = 0;
       algp = strtok (NULL, " ");
       if ( (NULL == algp) ||
            ( (0 == (type = rfc4034_mnemonic_to_value (typep))) &&

Modified: gnunet/src/nse/perf_kdf.c
===================================================================
--- gnunet/src/nse/perf_kdf.c   2016-07-06 13:25:24 UTC (rev 37467)
+++ gnunet/src/nse/perf_kdf.c   2016-07-06 15:24:26 UTC (rev 37468)
@@ -76,9 +76,9 @@
           GNUNET_STRINGS_relative_time_to_string 
(GNUNET_TIME_absolute_get_duration (start),
                                                  GNUNET_YES));
   GAUGER ("NSE", "Proof-of-work hashing",
-          1024LL / (1LL +
+          1024.0 / (1.0 +
                  GNUNET_TIME_absolute_get_duration
-                 (start).rel_value_us / 1000LL), "hashes/ms");
+                 (start).rel_value_us / 1000.0), "hashes/ms");
   return 0;
 }
 

Modified: gnunet/src/regex/regex_internal.c
===================================================================
--- gnunet/src/regex/regex_internal.c   2016-07-06 13:25:24 UTC (rev 37467)
+++ gnunet/src/regex/regex_internal.c   2016-07-06 15:24:26 UTC (rev 37468)
@@ -2010,7 +2010,7 @@
       if ( (s1->accepting && !s2->accepting) ||
           (!s1->accepting && s2->accepting) )
       {
-       idx = s1->marked * state_cnt + s2->marked;
+       idx = (unsigned long long) s1->marked * state_cnt + s2->marked;
         table[idx / 32] |= (1 << (idx % 32));
       }
 
@@ -2023,7 +2023,7 @@
     {
       for (s2 = a->states_head; NULL != s2 && s1 != s2; s2 = s2->next)
       {
-       idx = s1->marked * state_cnt + s2->marked;
+       idx = (unsigned long long) s1->marked * state_cnt + s2->marked;
         if (0 != (table[idx / 32] & (1 << (idx % 32))))
           continue;
         num_equal_edges = 0;

Modified: gnunet/src/set/gnunet-service-set_union.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union.c   2016-07-06 13:25:24 UTC (rev 
37467)
+++ gnunet/src/set/gnunet-service-set_union.c   2016-07-06 15:24:26 UTC (rev 
37468)
@@ -449,7 +449,7 @@
 
 static void
 salt_key (const struct IBF_Key *k_in,
-          uint32_t salt, 
+          uint32_t salt,
           struct IBF_Key *k_out)
 {
   int s = salt % 64;
@@ -462,7 +462,7 @@
 
 static void
 unsalt_key (const struct IBF_Key *k_in,
-            uint32_t salt, 
+            uint32_t salt,
             struct IBF_Key *k_out)
 {
   int s = salt % 64;
@@ -752,6 +752,7 @@
   {
     /* decompression failed */
     fail_union_operation (op);
+    strata_estimator_destroy (remote_se);
     return GNUNET_SYSERR;
   }
   GNUNET_assert (NULL != op->state->se);

Modified: gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c
===================================================================
--- gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c        2016-07-06 
13:25:24 UTC (rev 37467)
+++ gnunet/src/testbed/gnunet-daemon-testbed-blacklist.c        2016-07-06 
15:24:26 UTC (rev 37468)
@@ -211,7 +211,6 @@
   GNUNET_asprintf (&fname,
                    "%s/blacklist",
                    shome);
-  GNUNET_free (fname);
   if (GNUNET_YES == GNUNET_DISK_file_test (fname))
   {
     mode = ACCESS_DENY;
@@ -218,7 +217,7 @@
     setup_ac (shome, c);
   }
   GNUNET_free (shome);
-  return;
+  GNUNET_free (fname);
 }
 
 

Modified: gnunet/src/testbed-logger/testbed_logger_api.c
===================================================================
--- gnunet/src/testbed-logger/testbed_logger_api.c      2016-07-06 13:25:24 UTC 
(rev 37467)
+++ gnunet/src/testbed-logger/testbed_logger_api.c      2016-07-06 15:24:26 UTC 
(rev 37468)
@@ -312,7 +312,7 @@
   h->cb = cb;
   h->cb_cls = cb_cls;
   if ( (NULL == h->mq) ||
-       (NULL == h->buf) )
+       (0 == h->buse) )
   {
     trigger_flush_notification (h);
     return;

Modified: gnunet/src/util/test_container_multihashmap.c
===================================================================
--- gnunet/src/util/test_container_multihashmap.c       2016-07-06 13:25:24 UTC 
(rev 37467)
+++ gnunet/src/util/test_container_multihashmap.c       2016-07-06 15:24:26 UTC 
(rev 37468)
@@ -27,7 +27,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 
-#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if 
(m != NULL) GNUNET_CONTAINER_multihashmap_destroy(m); return 1; }
+#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if 
(m != NULL) GNUNET_CONTAINER_multihashmap_destroy(m); if (NULL != iter) 
GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); return 1; }
 #define CHECK(c) { if (! (c)) ABORT(); }
 
 static int
@@ -36,7 +36,7 @@
   struct GNUNET_CONTAINER_MultiHashMap *m;
   struct GNUNET_HashCode k1;
   struct GNUNET_HashCode k2;
-  struct GNUNET_CONTAINER_MultiHashMapIterator *iter;
+  struct GNUNET_CONTAINER_MultiHashMapIterator *iter = NULL;
   struct GNUNET_HashCode key_ret;
   const char *ret;
   int j;
@@ -97,7 +97,7 @@
   for (j = 0; j < GNUNET_CONTAINER_multihashmap_size (m); j++)
     CHECK (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, 
NULL, NULL));
   CHECK (GNUNET_NO == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, 
NULL));
-  GNUNET_free (iter);
+  GNUNET_CONTAINER_multihashmap_iterator_destroy (iter);
 
   GNUNET_CONTAINER_multihashmap_destroy (m);
   return 0;

Modified: gnunet/src/util/test_container_multipeermap.c
===================================================================
--- gnunet/src/util/test_container_multipeermap.c       2016-07-06 13:25:24 UTC 
(rev 37467)
+++ gnunet/src/util/test_container_multipeermap.c       2016-07-06 15:24:26 UTC 
(rev 37468)
@@ -27,7 +27,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 
-#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if 
(NULL != m) GNUNET_CONTAINER_multipeermap_destroy(m); return 1; }
+#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if 
(NULL != m) GNUNET_CONTAINER_multipeermap_destroy(m); if (NULL != iter) 
GNUNET_CONTAINER_multipeermap_iterator_destroy (iter); return 1; }
 #define CHECK(c) { if (! (c)) ABORT(); }
 
 static int
@@ -36,7 +36,7 @@
   struct GNUNET_CONTAINER_MultiPeerMap *m;
   struct GNUNET_PeerIdentity k1;
   struct GNUNET_PeerIdentity k2;
-  struct GNUNET_CONTAINER_MultiPeerMapIterator *iter;
+  struct GNUNET_CONTAINER_MultiPeerMapIterator *iter = NULL;
   struct GNUNET_PeerIdentity key_ret;
   const char *ret;
   int j;
@@ -97,7 +97,7 @@
   for (j = 0; j < GNUNET_CONTAINER_multipeermap_size (m); j++)
     CHECK (GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next (iter, 
NULL, NULL));
   CHECK (GNUNET_NO == GNUNET_CONTAINER_multipeermap_iterator_next (iter, NULL, 
NULL));
-  GNUNET_free (iter);
+  GNUNET_CONTAINER_multipeermap_iterator_destroy (iter);
 
   GNUNET_CONTAINER_multipeermap_destroy (m);
   return 0;




reply via email to

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