- check hashmap for initialization
authorBart Polot <bart@net.in.tum.de>
Fri, 30 Aug 2013 05:42:28 +0000 (05:42 +0000)
committerBart Polot <bart@net.in.tum.de>
Fri, 30 Aug 2013 05:42:28 +0000 (05:42 +0000)
src/mesh/gnunet-service-mesh-enc.c

index 99a01d70186615b11d34818322b32176c297e3d6..0bb1a97121be6a7bbc2a75826c75759629a8b086 100644 (file)
@@ -3241,9 +3241,19 @@ tunnel_use_path (struct MeshTunnel2 *t, struct MeshPeerPath *p)
   }
 
   peer = connection_get_next_hop (c);
+  if (NULL == peer->connections)
+  {
+    connection_destroy (c);
+    return NULL;
+  }
   GNUNET_CONTAINER_multihashmap_put (peer->connections, &c->id, c,
                                      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
   peer = connection_get_prev_hop (c);
+  if (NULL == peer->connections)
+  {
+    connection_destroy (c);
+    return NULL;
+  }
   GNUNET_CONTAINER_multihashmap_put (peer->connections, &c->id, c,
                                      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
   return c;