use NULL as flag for evaluation of query, ensure we pass non-NULL for reply_block...
[oweals/gnunet.git] / src / util / test_container_multihashmap.c
index 0a502370e3491c3e93ba7e0ce462c07a1cf363fe..a0ef8aa368d000d5e84d0e505d6ff06e6ab64889 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2008 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2008 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -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 @@ testMap (int i)
   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 @@ testMap (int i)
   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;