Additional extra check for coverity 10211
authorBart Polot <bart@net.in.tum.de>
Fri, 14 Oct 2011 11:29:21 +0000 (11:29 +0000)
committerBart Polot <bart@net.in.tum.de>
Fri, 14 Oct 2011 11:29:21 +0000 (11:29 +0000)
src/mesh/gnunet-service-mesh.c

index 1c636443b6fc6c73214df7f07ef33973d1d30bd2..773710611558293f112bb0aaddca1d5badd52204 100644 (file)
@@ -698,6 +698,7 @@ send_subscribed_clients (const struct GNUNET_MessageHeader *msg,
 {
   struct GNUNET_PeerIdentity *oid;
   struct MeshClient *c;
+  struct MeshTunnel *t;
   MESH_TunnelNumber *tid;
   unsigned int count;
   uint16_t type;
@@ -733,7 +734,13 @@ send_subscribed_clients (const struct GNUNET_MessageHeader *msg,
       GNUNET_break (0);
       return 0;
   }
-  *tid = htonl (tunnel_get (oid, ntohl(*tid))->local_tid);
+  t = tunnel_get (oid, ntohl(*tid));
+  if (NULL == t)
+  {
+    GNUNET_break (0);
+    return 0;
+  }
+  *tid = htonl (t->local_tid);
   for (count = 0, c = clients; c != NULL; c = c->next)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH:    client %u\n", c->id);