From: Jonathan Rajotte Date: Wed, 29 Nov 2017 21:42:29 +0000 (-0500) Subject: Fix: consumerd(64/32)_lib_dir can be NULL X-Git-Tag: v2.10.2~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ed6c7ac8aef8112943e3e7ae3dedd0ff453f4c73;p=lttng-tools.git Fix: consumerd(64/32)_lib_dir can be NULL Reproducer: lttng-sessiond \ --consumerd32-path=/usr/local/lib/lttng/libexec/lttng-consumerd \ --consumerd64-path=/usr/local/lib/lttng/libexec/lttng-consumerd lttng create lttng enable-event -u -a On a 64bit machine the invocation of the 64bit consumerd will not fail since its libdir is populated by sessiond_config_init but will segfault on spawning of the 32 bit consumerd when performing the check of libdir value. On a 32bit machine the opposite will happen. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 3d0a65def..1eaf9bef3 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2442,7 +2442,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) { char *tmpnew = NULL; - if (config.consumerd64_lib_dir.value[0] != '\0') { + if (config.consumerd64_lib_dir.value) { char *tmp; size_t tmplen; @@ -2476,16 +2476,14 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) "--consumerd-err-sock", consumer_data->err_unix_sock_path, "--group", config.tracing_group_name.value, NULL); - if (config.consumerd64_lib_dir.value[0] != '\0') { - free(tmpnew); - } + free(tmpnew); break; } case LTTNG_CONSUMER32_UST: { char *tmpnew = NULL; - if (config.consumerd32_lib_dir.value[0] != '\0') { + if (config.consumerd32_lib_dir.value) { char *tmp; size_t tmplen; @@ -2519,9 +2517,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) "--consumerd-err-sock", consumer_data->err_unix_sock_path, "--group", config.tracing_group_name.value, NULL); - if (config.consumerd32_lib_dir.value[0] != '\0') { - free(tmpnew); - } + free(tmpnew); break; } default: