[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30720 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30720 - gnunet/src/mesh |
Date: |
Fri, 15 Nov 2013 14:07:55 +0100 |
Author: bartpolot
Date: 2013-11-15 14:07:55 +0100 (Fri, 15 Nov 2013)
New Revision: 30720
Modified:
gnunet/src/mesh/gnunet-service-mesh_connection.c
Log:
- fix coverity 10814
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-11-15 13:00:43 UTC
(rev 30719)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-11-15 13:07:55 UTC
(rev 30720)
@@ -1077,26 +1077,27 @@
* Add the connection to the list of both neighbors.
*
* @param c Connection.
+ *
+ * @return #GNUNET_OK if everything went fine
+ * #GNUNET_SYSERR if the was an error and @c c is malformed.
*/
-static void
+static int
register_neighbors (struct MeshConnection *c)
{
- struct MeshPeer *peer;
+ struct MeshPeer *next_peer;
+ struct MeshPeer *prev_peer;
- peer = get_next_hop (c);
- if (GNUNET_NO == GMP_is_neighbor (peer))
- {
- GMC_destroy (c);
- return;
- }
- GMP_add_connection (peer, c);
- peer = get_prev_hop (c);
- if (GNUNET_NO == GMP_is_neighbor (peer))
- {
- GMC_destroy (c);
- return;
- }
- GMP_add_connection (peer, c);
+ next_peer = get_next_hop (c);
+ prev_peer = get_prev_hop (c);
+
+ if (GNUNET_NO == GMP_is_neighbor (next_peer)
+ || GNUNET_NO == GMP_is_neighbor (prev_peer))
+ return GNUNET_SYSERR;
+
+ GMP_add_connection (next_peer, c);
+ GMP_add_connection (prev_peer, c);
+
+ return GNUNET_OK;
}
@@ -2102,7 +2103,12 @@
GNUNET_SCHEDULER_add_delayed (create_connection_time,
&connection_fwd_keepalive, c);
}
- register_neighbors (c);
+ if (GNUNET_OK != register_neighbors (c))
+ {
+ GMC_destroy (c);
+ return NULL;
+ }
+
return c;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30720 - gnunet/src/mesh,
gnunet <=