X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=6f9834425192c3ca4b1f9f0e184071eb87f68b87;hp=efaaf4ffa99f40c5cc0dac877e796a7eda86e5ea;hb=020d7f606b4264ec26bdae8b84d6e85182539ab2;hpb=e56251fcd578c85ad24a36b3768fa6b095fc59e1 diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index efaaf4ffa..6f9834425 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -1380,6 +1380,11 @@ static void *thread_dispatch_ust_registration(void *data) wait_node = zmalloc(sizeof(*wait_node)); if (!wait_node) { PERROR("zmalloc wait_node dispatch"); + ret = close(ust_cmd->sock); + if (ret < 0) { + PERROR("close ust sock dispatch %d", ust_cmd->sock); + } + lttng_fd_put(1, LTTNG_FD_APPS); free(ust_cmd); goto error; } @@ -1427,6 +1432,19 @@ static void *thread_dispatch_ust_registration(void *data) break; } } + + /* + * With no application at this stage the received socket is + * basically useless so close it before we free the cmd data + * structure for good. + */ + if (!app) { + ret = close(ust_cmd->sock); + if (ret < 0) { + PERROR("close ust sock dispatch %d", ust_cmd->sock); + } + lttng_fd_put(1, LTTNG_FD_APPS); + } free(ust_cmd); } @@ -1488,13 +1506,6 @@ static void *thread_dispatch_ust_registration(void *data) rcu_read_unlock(); session_unlock_list(); - } else { - /* Application manager threads are not available. */ - ret = close(ust_cmd->sock); - if (ret < 0) { - PERROR("close ust_cmd sock"); - } - lttng_fd_put(1, LTTNG_FD_APPS); } } while (node != NULL);