aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-09 20:59:20 +0000
committerDave Barach <openvpp@barachs.net>2020-04-09 22:47:02 +0000
commit12813d5e4a7b858304093ce5f76026f456c79b98 (patch)
tree6173df413ea7e1b2f7df3e27181a5324e9720105
parent573f44c2f5c883753bc9880eead1bd662586521d (diff)
session: fix leak on accept fifo alloc failure
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia928d6ea05ff7cb9a15e1ddc58234d000ebfd7fb
-rw-r--r--src/vnet/session/application_local.c5
-rw-r--r--src/vnet/session/session.c16
2 files changed, 15 insertions, 6 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 0e1f6db19fb..927bf91a040 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -294,7 +294,6 @@ ct_connect (app_worker_t * client_wrk, session_t * ll,
if (ct_init_local_session (client_wrk, server_wrk, sct, ss, ll))
{
- clib_warning ("failed");
ct_connection_free (sct);
session_free (ss);
return -1;
@@ -303,9 +302,9 @@ ct_connect (app_worker_t * client_wrk, session_t * ll,
ss->session_state = SESSION_STATE_ACCEPTING;
if (app_worker_accept_notify (server_wrk, ss))
{
- clib_warning ("failed");
ct_connection_free (sct);
- session_free_w_fifos (ss);
+ segment_manager_dealloc_fifos (ss->rx_fifo, ss->tx_fifo);
+ session_free (ss);
return -1;
}
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 1fa787217f3..d2dc85efa4e 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1104,7 +1104,10 @@ session_stream_accept (transport_connection_t * tc, u32 listener_index,
s->session_state = SESSION_STATE_CREATED;
if ((rv = app_worker_init_accepted (s)))
- return rv;
+ {
+ session_free (s);
+ return rv;
+ }
session_lookup_add_connection (tc, session_handle (s));
@@ -1112,7 +1115,13 @@ session_stream_accept (transport_connection_t * tc, u32 listener_index,
if (notify)
{
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
- return app_worker_accept_notify (app_wrk, s);
+ if ((rv = app_worker_accept_notify (app_wrk, s)))
+ {
+ session_lookup_del_session (s);
+ segment_manager_dealloc_fifos (s->rx_fifo, s->tx_fifo);
+ session_free (s);
+ return rv;
+ }
}
return 0;
@@ -1138,7 +1147,8 @@ session_dgram_accept (transport_connection_t * tc, u32 listener_index,
app_wrk = app_worker_get (s->app_wrk_index);
if ((rv = app_worker_accept_notify (app_wrk, s)))
{
- session_free_w_fifos (s);
+ segment_manager_dealloc_fifos (s->rx_fifo, s->tx_fifo);
+ session_free (s);
return rv;
}