session: fix closing ntfs handling for refused sessions

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1464e93cd3020eaa26068df558924e39dd255ccb
diff --git a/src/vnet/session/session_input.c b/src/vnet/session/session_input.c
index 41e8beb..5899242 100644
--- a/src/vnet/session/session_input.c
+++ b/src/vnet/session/session_input.c
@@ -225,11 +225,17 @@
 	  break;
 	case SESSION_CTRL_EVT_TRANSPORT_CLOSED:
 	  s = session_get (evt->session_index, thread_index);
+	  /* Notification enqueued before session was refused by app */
+	  if (PREDICT_FALSE (s->app_wrk_index == APP_INVALID_INDEX))
+	    break;
 	  if (app->cb_fns.session_transport_closed_callback)
 	    app->cb_fns.session_transport_closed_callback (s);
 	  break;
 	case SESSION_CTRL_EVT_CLEANUP:
 	  s = session_get (evt->as_u64[0] & 0xffffffff, thread_index);
+	  /* Notification enqueued before session was refused by app */
+	  if (PREDICT_FALSE (s->app_wrk_index == APP_INVALID_INDEX))
+	    break;
 	  if (app->cb_fns.session_cleanup_callback)
 	    app->cb_fns.session_cleanup_callback (s, evt->as_u64[0] >> 32);
 	  if (evt->as_u64[0] >> 32 != SESSION_CLEANUP_SESSION)