]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Suppress a coverity false positive in connection_edge_package_raw_inbuf
authorNick Mathewson <nickm@torproject.org>
Mon, 11 Feb 2013 20:55:50 +0000 (15:55 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 11 Feb 2013 20:55:50 +0000 (15:55 -0500)
Coverity is worried that we're checking entry_conn in some cases,
but not in the case where we set entry_conn->pending_optimistic_data.

This commit should calm it down (CID 718623).

src/or/relay.c

index 12283fcbbb9a514fbc33f8cb5ecde79169212e1f..22bc40d655b4951e552685b347b875ed856a37d7 100644 (file)
@@ -1563,11 +1563,12 @@ connection_edge_package_raw_inbuf(edge_connection_t *conn, int package_partial,
   circuit_t *circ;
   const unsigned domain = conn->base_.type == CONN_TYPE_AP ? LD_APP : LD_EXIT;
   int sending_from_optimistic = 0;
+  entry_connection_t *entry_conn =
+    conn->base_.type == CONN_TYPE_AP ? EDGE_TO_ENTRY_CONN(conn) : NULL;
   const int sending_optimistically =
+    entry_conn &&
     conn->base_.type == CONN_TYPE_AP &&
     conn->base_.state != AP_CONN_STATE_OPEN;
-  entry_connection_t *entry_conn =
-    conn->base_.type == CONN_TYPE_AP ? EDGE_TO_ENTRY_CONN(conn) : NULL;
   crypt_path_t *cpath_layer = conn->cpath_layer;
 
   tor_assert(conn);