-rps _custommap: more assertions (keep coverity happy?)
authorJulius Bünger <buenger@mytum.de>
Wed, 14 Sep 2016 23:09:14 +0000 (23:09 +0000)
committerJulius Bünger <buenger@mytum.de>
Wed, 14 Sep 2016 23:09:14 +0000 (23:09 +0000)
src/rps/gnunet-service-rps_custommap.c

index b88de828537535b4a4cd3d79acf6bdd0afc9ba5a..158dcc43ced008467fca4a4e683070be01990c1d 100644 (file)
@@ -209,9 +209,11 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
       GNUNET_CONTAINER_multihashmap32_get (c_peer_map->hash_map,
                                            CustomPeerMap_size (c_peer_map));
     GNUNET_assert (NULL != last_p);
+    last_index = GNUNET_CONTAINER_multipeermap_get (c_peer_map->peer_map, last_p);
+    GNUNET_assert (NULL != last_index);
+    GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index);
     GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, *index, last_p,
         GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
-    last_index = GNUNET_CONTAINER_multipeermap_get (c_peer_map->peer_map, last_p);
     GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, *last_index);
     *last_index = *index;
   }