gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r32321 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r32321 - gnunet/src/testbed
Date: Wed, 12 Feb 2014 11:22:35 +0100

Author: harsha
Date: 2014-02-12 11:22:35 +0100 (Wed, 12 Feb 2014)
New Revision: 32321

Modified:
   gnunet/src/testbed/gnunet-service-testbed_cache.c
Log:
- Cleanup cache items after removing from the hashmap.


Modified: gnunet/src/testbed/gnunet-service-testbed_cache.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_cache.c   2014-02-12 06:39:22 UTC 
(rev 32320)
+++ gnunet/src/testbed/gnunet-service-testbed_cache.c   2014-02-12 10:22:35 UTC 
(rev 32321)
@@ -112,6 +112,20 @@
 
 
 /**
+ * Free the resources occupied by a cache entry
+ *
+ * @param entry the cache entry to free
+ */
+static void
+free_entry (struct CacheEntry *entry)
+{
+  GNUNET_CONTAINER_DLL_remove (cache_head, cache_tail, entry);
+  GNUNET_free_non_null (entry->hello);
+  GNUNET_free (entry);
+}
+
+
+/**
  * Creates a new cache entry and then puts it into the cache's hashtable.
  *
  * @param peer_id the index of the peer to tag the newly created entry
@@ -131,6 +145,7 @@
                    GNUNET_CONTAINER_multihashmap32_remove (cache, (uint32_t)
                                                            entry->peer_id,
                                                            entry));
+    free_entry (entry);
   }
   entry = GNUNET_new (struct CacheEntry);
   entry->peer_id = peer_id;
@@ -162,8 +177,7 @@
   GNUNET_assert (NULL != entry);
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CONTAINER_multihashmap32_remove (cache, key, value));
-  GNUNET_free_non_null (entry->hello);
-  GNUNET_free (entry);
+  free_entry (entry);
   return GNUNET_YES;
 }
 




reply via email to

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