diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-09-13 17:14:57 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-09-20 20:01:02 +0000 |
commit | 1afa7afffad6e296a97556aa4c9482f4cd544074 (patch) | |
tree | 8336ca310de06dcf305d336f2ad011d6221b226b /src/vnet | |
parent | afef8bf22369d10ab8107a63b1e3529ed7dd6c8d (diff) |
session: fix msg freeing on error
Type: fix
Change-Id: I0807f84737d5e98e69e9ed27a1de6813b2ddd138
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/session/application_interface.h | 5 | ||||
-rw-r--r-- | src/vnet/session/session.c | 15 |
2 files changed, 7 insertions, 13 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index f5f684e37da..637a055b3d8 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -486,11 +486,6 @@ app_send_io_evt_to_vpp (svm_msg_q_t * mq, u32 session_index, u8 evt_type, return -2; } msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); - if (PREDICT_FALSE (svm_msg_q_msg_is_invalid (&msg))) - { - svm_msg_q_unlock (mq); - return -2; - } evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); evt->session_index = session_index; evt->event_type = evt_type; diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 382db8ba543..f14e83fe976 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -41,17 +41,11 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index, svm_msg_q_unlock (mq); return -2; } - msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); - if (PREDICT_FALSE (svm_msg_q_msg_is_invalid (&msg))) - { - svm_msg_q_unlock (mq); - return -2; - } - evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); - evt->event_type = evt_type; switch (evt_type) { case SESSION_CTRL_EVT_RPC: + msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); + evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); evt->rpc_args.fp = data; evt->rpc_args.arg = args; break; @@ -59,11 +53,15 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index, case SESSION_IO_EVT_TX: case SESSION_IO_EVT_TX_FLUSH: case SESSION_IO_EVT_BUILTIN_RX: + msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); + evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); evt->session_index = *(u32 *) data; break; case SESSION_IO_EVT_BUILTIN_TX: case SESSION_CTRL_EVT_CLOSE: case SESSION_CTRL_EVT_RESET: + msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); + evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); evt->session_handle = session_handle ((session_t *) data); break; default: @@ -71,6 +69,7 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index, svm_msg_q_unlock (mq); return -1; } + evt->event_type = evt_type; svm_msg_q_add_and_unlock (mq, &msg); return 0; |