From: Jérémie Galarneau Date: Mon, 2 Nov 2015 22:51:04 +0000 (-0500) Subject: Fix: Check for NULL hash tables on relay daemon teardown X-Git-Tag: v2.8.0-rc1~235 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ce3f3ba3aee62c0a317b448c2f19578ab7f057e4;p=lttng-tools.git Fix: Check for NULL hash tables on relay daemon teardown 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 --- diff --git a/src/bin/lttng-relayd/session.c b/src/bin/lttng-relayd/session.c index 7fffea8af..d1c2098f8 100644 --- a/src/bin/lttng-relayd/session.c +++ b/src/bin/lttng-relayd/session.c @@ -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) { diff --git a/src/bin/lttng-relayd/stream.c b/src/bin/lttng-relayd/stream.c index cbd7ceb88..335a1cf5f 100644 --- a/src/bin/lttng-relayd/stream.c +++ b/src/bin/lttng-relayd/stream.c @@ -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) { diff --git a/src/bin/lttng-relayd/viewer-stream.c b/src/bin/lttng-relayd/viewer-stream.c index 623f94ca7..7c59cd05d 100644 --- a/src/bin/lttng-relayd/viewer-stream.c +++ b/src/bin/lttng-relayd/viewer-stream.c @@ -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) {