summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/application.c')
-rw-r--r--src/vnet/session/application.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 1c46e786e13..68bbd59098e 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -445,13 +445,9 @@ application_start_listen (application_t * srv, session_endpoint_t * sep,
s = listen_session_new (0, sst);
s->app_index = srv->index;
- if (stream_session_listen (s, sep))
- goto err;
-
/* Allocate segment manager. All sessions derived out of a listen session
* have fifos allocated by the same segment manager. */
- sm = application_alloc_segment_manager (srv);
- if (sm == 0)
+ if (!(sm = application_alloc_segment_manager (srv)))
goto err;
/* Add to app's listener table. Useful to find all child listeners
@@ -459,6 +455,13 @@ application_start_listen (application_t * srv, session_endpoint_t * sep,
handle = listen_session_get_handle (s);
hash_set (srv->listeners_table, handle, segment_manager_index (sm));
+ if (stream_session_listen (s, sep))
+ {
+ segment_manager_del (sm);
+ hash_unset (srv->listeners_table, handle);
+ goto err;
+ }
+
*res = handle;
return 0;