X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=cf15ff9b02a4aec563614c699ec161f221f270ee;hb=06f525de3c141168b3bc367a9b87b35d7709abf5;hp=2f0a39fede12d5e130d9fc8f88f011dd2f80dc96;hpb=806e2684ce24d3772af37ee46c5f0500c7a0723f;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 2f0a39fed..cf15ff9b0 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -1926,6 +1926,15 @@ static int copy_session_consumer(int domain, struct ltt_session *session) switch (domain) { case LTTNG_DOMAIN_KERNEL: DBG3("Copying tracing session consumer output in kernel session"); + /* + * XXX: We should audit the session creation and what this function + * does "extra" in order to avoid a destroy since this function is used + * in the domain session creation (kernel and ust) only. Same for UST + * domain. + */ + if (session->kernel_session->consumer) { + consumer_destroy_output(session->kernel_session->consumer); + } session->kernel_session->consumer = consumer_copy_output(session->consumer); /* Ease our life a bit for the next part */ @@ -1934,6 +1943,9 @@ static int copy_session_consumer(int domain, struct ltt_session *session) break; case LTTNG_DOMAIN_UST: DBG3("Copying tracing session consumer output in UST session"); + if (session->ust_session->consumer) { + consumer_destroy_output(session->ust_session->consumer); + } session->ust_session->consumer = consumer_copy_output(session->consumer); /* Ease our life a bit for the next part */ @@ -2541,12 +2553,14 @@ skip_domain: DBG("No URIs received from client... continuing"); *sock_error = 1; ret = LTTNG_ERR_SESSION_FAIL; + free(uris); goto error; } ret = cmd_set_consumer_uri(cmd_ctx->lsm->domain.type, cmd_ctx->session, nb_uri, uris); if (ret != LTTNG_OK) { + free(uris); goto error; } @@ -2567,6 +2581,8 @@ skip_domain: } } + free(uris); + break; } case LTTNG_START_TRACE: @@ -2601,12 +2617,14 @@ skip_domain: DBG("No URIs received from client... continuing"); *sock_error = 1; ret = LTTNG_ERR_SESSION_FAIL; + free(uris); goto error; } if (nb_uri == 1 && uris[0].dtype != LTTNG_DST_PATH) { DBG("Creating session with ONE network URI is a bad call"); ret = LTTNG_ERR_SESSION_FAIL; + free(uris); goto error; } } @@ -2614,6 +2632,8 @@ skip_domain: ret = cmd_create_session_uri(cmd_ctx->lsm->session.name, uris, nb_uri, &cmd_ctx->creds); + free(uris); + break; } case LTTNG_DESTROY_SESSION: @@ -3965,6 +3985,9 @@ int main(int argc, char **argv) health_init(&ustconsumer64_data.health); health_poll_update(&ustconsumer64_data.health); + /* Not needed anymore. */ + free(rundir); + /* Create thread to manage the client socket */ ret = pthread_create(&health_thread, NULL, thread_manage_health, (void *) NULL); @@ -4053,7 +4076,25 @@ exit_dispatch: goto error; /* join error, exit without cleanup */ } + ret = join_consumer_thread(&ustconsumer32_data); + if (ret != 0) { + PERROR("join_consumer ust32"); + goto error; /* join error, exit without cleanup */ + } + + ret = join_consumer_thread(&ustconsumer64_data); + if (ret != 0) { + PERROR("join_consumer ust64"); + goto error; /* join error, exit without cleanup */ + } + exit_client: + ret = pthread_join(health_thread, &status); + if (ret != 0) { + PERROR("pthread_join health thread"); + goto error; /* join error, exit without cleanup */ + } + exit_health: exit: /*