X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fregister.c;h=ecb0dfef07457e1ca68aa76d749ed9981cbf4c10;hb=e000e56fbef34cf51b9a45a9e40d5e2513fe578f;hp=d0a1ff14a69dc3173d89fbcf866de09fdb339816;hpb=2863220c993ba6c7a8fe29e904c66fa8ffd7132d;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/register.c b/src/bin/lttng-sessiond/register.c index d0a1ff14a..ecb0dfef0 100644 --- a/src/bin/lttng-sessiond/register.c +++ b/src/bin/lttng-sessiond/register.c @@ -72,7 +72,7 @@ static int create_application_socket(void) if (ret < 0) { PERROR("Set file permissions failed on %s", config.apps_unix_sock_path.value); - goto end; + goto error_close_socket; } DBG3("Session daemon application socket created (fd = %d) ", apps_sock); @@ -80,6 +80,13 @@ static int create_application_socket(void) end: umask(old_umask); return ret; +error_close_socket: + if (close(apps_sock)) { + PERROR("Failed to close application socket in error path"); + } + apps_sock = -1; + ret = -1; + goto end; } /* @@ -239,11 +246,6 @@ static void *thread_application_registration(void *data) revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ if (pollfd == quit_pipe_read_fd) { err = 0; @@ -400,13 +402,12 @@ struct lttng_thread *launch_application_registration_thread( struct thread_notifiers *notifiers = NULL; struct lttng_thread *thread; - quit_pipe = lttng_pipe_open(FD_CLOEXEC); - if (!quit_pipe) { - goto error; - } - notifiers = zmalloc(sizeof(*notifiers)); if (!notifiers) { + goto error_alloc; + } + quit_pipe = lttng_pipe_open(FD_CLOEXEC); + if (!quit_pipe) { goto error; } notifiers->quit_pipe = quit_pipe; @@ -428,5 +429,6 @@ struct lttng_thread *launch_application_registration_thread( return thread; error: cleanup_application_registration_thread(notifiers); +error_alloc: return NULL; }