Fix: consumerd(64/32)_lib_dir can be NULL
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 29 Nov 2017 21:42:29 +0000 (16:42 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 30 Nov 2017 22:53:12 +0000 (23:53 +0100)
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 <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/main.c

index 3d0a65def51a0a727c3a5d08539c035f341701f5..1eaf9bef330ff62a74b9665c88fc490824d94728 100644 (file)
@@ -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:
This page took 0.038006 seconds and 4 git commands to generate.