aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Lenco <milan.lenco@pantheon.tech>2017-04-05 15:05:12 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-04-05 15:34:10 +0000
commitf7f4535510aa2abbe5ac20002d8b1e43c1c368df (patch)
tree30af1450e481dbc6d87c1e89373eee1aac957188
parentc6cd26d520195ffcc6baa523298a6e762f6579aa (diff)
Fix two more memif coverity issues
Change-Id: Iff7e1562d395f1f2e000fa8c2e98bb85969479d7 Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
-rw-r--r--src/plugins/memif/memif.c13
-rw-r--r--src/plugins/memif/node.c44
2 files changed, 32 insertions, 25 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index 3ea95f3bb6e..f4358626dde 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -241,6 +241,7 @@ memif_process_connect_req (memif_pending_conn_t * pending_conn,
uf->private_data = mif->if_index << 1;
mif->connection = pending_conn->connection;
pool_put (mm->pending_conns, pending_conn);
+ pending_conn = 0;
memif_connect (vm, mif);
@@ -252,7 +253,17 @@ response:
{
DEBUG_UNIX_LOG ("Failed to send connection response");
error = clib_error_return_unix (0, "send fd %d", fd);
- memif_disconnect (vm, mif);
+ if (pending_conn)
+ memif_remove_pending_conn (pending_conn);
+ else
+ memif_disconnect (vm, mif);
+ }
+ if (retval > 0)
+ {
+ if (shm_fd >= 0)
+ close (shm_fd);
+ if (int_fd >= 0)
+ close (int_fd);
}
return error;
}
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 298472b04b7..659d5dfb5ee 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -214,20 +214,19 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE (n_trace > 0))
{
- if (b0)
- {
- memif_input_trace_t *tr;
- vlib_trace_buffer (vm, node, next0, b0,
- /* follow_chain */ 0);
- vlib_set_trace_count (vm, node, --n_trace);
- tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
- tr->next_index = next0;
- tr->hw_if_index = mif->hw_if_index;
- tr->ring = rid;
- }
-
- if (n_trace && b1)
+ /* b0 */
+ memif_input_trace_t *tr;
+ vlib_trace_buffer (vm, node, next0, b0,
+ /* follow_chain */ 0);
+ vlib_set_trace_count (vm, node, --n_trace);
+ tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
+ tr->next_index = next0;
+ tr->hw_if_index = mif->hw_if_index;
+ tr->ring = rid;
+
+ if (n_trace)
{
+ /* b1 */
memif_input_trace_t *tr;
vlib_trace_buffer (vm, node, next1, b1,
/* follow_chain */ 0);
@@ -286,17 +285,14 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE (n_trace > 0))
{
- if (b0)
- {
- memif_input_trace_t *tr;
- vlib_trace_buffer (vm, node, next0, b0,
- /* follow_chain */ 0);
- vlib_set_trace_count (vm, node, --n_trace);
- tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
- tr->next_index = next0;
- tr->hw_if_index = mif->hw_if_index;
- tr->ring = rid;
- }
+ memif_input_trace_t *tr;
+ vlib_trace_buffer (vm, node, next0, b0,
+ /* follow_chain */ 0);
+ vlib_set_trace_count (vm, node, --n_trace);
+ tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
+ tr->next_index = next0;
+ tr->hw_if_index = mif->hw_if_index;
+ tr->ring = rid;
}