X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=efaaf4ffa99f40c5cc0dac877e796a7eda86e5ea;hb=3cc048812bf25b42003b40b6b868b9366faefafb;hp=445485b417d5d0b0e0cd6f1de4eaab41336baaf5;hpb=36b588eddce05ef840bd247f6a58316925b9a0a2;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 445485b41..efaaf4ffa 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -232,6 +232,9 @@ static enum consumerd_state kernel_consumerd_state; */ static int app_socket_timeout; +/* Set in main() with the current page size. */ +long page_size; + static void setup_consumerd_path(void) { @@ -2892,6 +2895,7 @@ skip_domain: ret = setup_lttng_msg(cmd_ctx, nb_dom * sizeof(struct lttng_domain)); if (ret < 0) { + free(domains); goto setup_error; } @@ -2919,6 +2923,7 @@ skip_domain: ret = setup_lttng_msg(cmd_ctx, nb_chan * sizeof(struct lttng_channel)); if (ret < 0) { + free(channels); goto setup_error; } @@ -2946,6 +2951,7 @@ skip_domain: ret = setup_lttng_msg(cmd_ctx, nb_event * sizeof(struct lttng_event)); if (ret < 0) { + free(events); goto setup_error; } @@ -3091,6 +3097,10 @@ static void *thread_manage_health(void *data) rcu_register_thread(); + /* We might hit an error path before this is set once. */ + memset(&events, 0, sizeof(events)); + events.epfd = -1; + /* Create unix socket */ sock = lttcomm_create_unix_sock(health_unix_sock_path); if (sock < 0) { @@ -3443,13 +3453,11 @@ static void *thread_manage_clients(void *data) ret = process_client_msg(cmd_ctx, sock, &sock_error); rcu_thread_offline(); if (ret < 0) { - if (sock_error) { - ret = close(sock); - if (ret) { - PERROR("close"); - } - sock = -1; + ret = close(sock); + if (ret) { + PERROR("close"); } + sock = -1; /* * TODO: Inform client somehow of the fatal error. At * this point, ret < 0 means that a zmalloc failed @@ -4038,6 +4046,13 @@ int main(int argc, char **argv) setup_consumerd_path(); + page_size = sysconf(_SC_PAGESIZE); + if (page_size < 0) { + PERROR("sysconf _SC_PAGESIZE"); + page_size = LONG_MAX; + WARN("Fallback page size to %ld", page_size); + } + /* Parse arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv)) < 0) {