Fix: Check for NULL hash tables on relay daemon teardown
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 2 Nov 2015 22:51:04 +0000 (17:51 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 2 Nov 2015 22:51:04 +0000 (17:51 -0500)
The relay daemon will log any "leaked" object on exit. However,
some errors encountered early-on during the daemon's
initialization may result in the teardown being executed with
uninitialized hash tables.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/session.c
src/bin/lttng-relayd/stream.c
src/bin/lttng-relayd/viewer-stream.c

index 7fffea8af4d29145e97cb320786cc0265531106b..d1c2098f8591a3a8c9c5e87b022f43e8fff627ee 100644 (file)
@@ -230,6 +230,10 @@ void print_sessions(void)
        struct lttng_ht_iter iter;
        struct relay_session *session;
 
+       if (!sessions_ht) {
+               return;
+       }
+
        rcu_read_lock();
        cds_lfht_for_each_entry(sessions_ht->ht, &iter.iter, session,
                        session_n.node) {
index cbd7ceb88d4874a9866b2b4973d111f174d80edc..335a1cf5f79de497f3002beb3ae0a2a983da355f 100644 (file)
@@ -446,6 +446,10 @@ void print_relay_streams(void)
        struct lttng_ht_iter iter;
        struct relay_stream *stream;
 
+       if (!relay_streams_ht) {
+               return;
+       }
+
        rcu_read_lock();
        cds_lfht_for_each_entry(relay_streams_ht->ht, &iter.iter, stream,
                        node.node) {
index 623f94ca7fca4d059254d36bfc902ea030d17a03..7c59cd05d88ea3797569e87d8d964d67aa61e562 100644 (file)
@@ -338,6 +338,10 @@ void print_viewer_streams(void)
        struct lttng_ht_iter iter;
        struct relay_viewer_stream *vstream;
 
+       if (!viewer_streams_ht) {
+               return;
+       }
+
        rcu_read_lock();
        cds_lfht_for_each_entry(viewer_streams_ht->ht, &iter.iter, vstream,
                        stream_n.node) {
This page took 0.026868 seconds and 4 git commands to generate.