Fix: relayd: live: unchecked poll set creation return value
[lttng-tools.git] / src / bin / lttng-relayd / live.c
index a64d69b02e37f1f4413957f8e7e6e514d34d1e3e..06cfa5c7bb64da3321af4c251bf3f2a50580091e 100644 (file)
@@ -439,6 +439,10 @@ int create_named_thread_poll_set(struct lttng_poll_event *events,
 
        ret = fd_tracker_util_poll_create(the_fd_tracker,
                        name, events, 1, LTTNG_CLOEXEC);
+       if (ret) {
+               PERROR("Failed to create \"%s\" poll file descriptor", name);
+               goto error;
+       }
 
        /* Add quit pipe */
        ret = lttng_poll_add(events, thread_quit_pipe[0], LPOLLIN | LPOLLERR);
@@ -561,7 +565,11 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
        ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &sock_fd,
                        (const char **) (formated_name ? &formated_name : NULL),
                        1, create_sock, sock);
-       free(formated_name);
+       if (ret) {
+               PERROR("Failed to create \"%s\" socket",
+                               formated_name ?: "Unknown");
+               goto error;
+       }
        DBG("Listening on %s socket %d", name, sock->fd);
 
        ret = sock->ops->bind(sock);
@@ -576,12 +584,14 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
 
        }
 
+       free(formated_name);
        return sock;
 
 error:
        if (sock) {
                lttcomm_destroy_sock(sock);
        }
+       free(formated_name);
        return NULL;
 }
 
@@ -598,6 +608,7 @@ void *thread_listener(void *data)
 
        DBG("[thread] Relay live listener started");
 
+       rcu_register_thread();
        health_register(health_relayd, HEALTH_RELAYD_TYPE_LIVE_LISTENER);
 
        health_code_update();
@@ -739,6 +750,7 @@ error_sock_control:
                DBG("Live viewer listener thread exited with error");
        }
        health_unregister(health_relayd);
+       rcu_unregister_thread();
        DBG("Live viewer listener thread cleanup complete");
        if (lttng_relay_stop_threads()) {
                ERR("Error stopping threads");
This page took 0.023793 seconds and 4 git commands to generate.