Refactoring: use an opaque lttng_tracker_id type
[lttng-tools.git] / src / bin / lttng-sessiond / dispatch.c
index 8ef3c38cf21996de7014646c51cc4ac2ffb75dfa..bfe4455b59a9813174469e14c0688d3bddc1d942 100644 (file)
@@ -61,7 +61,7 @@ static void update_ust_app(int app_sock)
                        continue;
                }
                session_lock(sess);
-               if (!sess->ust_session) {
+               if (!sess->active || !sess->ust_session) {
                        goto unlock_session;
                }
 
@@ -144,11 +144,6 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
                uint32_t revents = LTTNG_POLL_GETEV(&events, i);
                int pollfd = LTTNG_POLL_GETFD(&events, i);
 
-               if (!revents) {
-                       /* No activity for this FD (poll implementation). */
-                       continue;
-               }
-
                cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
                                &wait_queue->head, head) {
                        if (pollfd == wait_node->app->sock &&
@@ -309,6 +304,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                        }
                                        lttng_fd_put(LTTNG_FD_APPS, 1);
                                        free(ust_cmd);
+                                       ust_cmd = NULL;
                                        goto error;
                                }
                                CDS_INIT_LIST_HEAD(&wait_node->head);
@@ -323,7 +319,9 @@ static void *thread_dispatch_ust_registration(void *data)
                                        }
                                        lttng_fd_put(LTTNG_FD_APPS, 1);
                                        free(wait_node);
+                                       wait_node = NULL;
                                        free(ust_cmd);
+                                       ust_cmd = NULL;
                                        continue;
                                }
                                /*
@@ -334,6 +332,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                wait_queue.count++;
 
                                free(ust_cmd);
+                               ust_cmd = NULL;
                                /*
                                 * We have to continue here since we don't have the notify
                                 * socket and the application MUST be added to the hash table
@@ -354,6 +353,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                                wait_queue.count--;
                                                app = wait_node->app;
                                                free(wait_node);
+                                               wait_node = NULL;
                                                DBG3("UST app notify socket %d is set", ust_cmd->sock);
                                                break;
                                        }
@@ -372,6 +372,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                        lttng_fd_put(LTTNG_FD_APPS, 1);
                                }
                                free(ust_cmd);
+                               ust_cmd = NULL;
                        }
 
                        if (app) {
This page took 0.023911 seconds and 4 git commands to generate.