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.7.1~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d71e55a5f1f423eeaa47c08e5797e47ce8e825fb;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 2300e5f1a..c2bf0f403 100644 --- a/src/bin/lttng-relayd/session.c +++ b/src/bin/lttng-relayd/session.c @@ -231,6 +231,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 8825d094c..9d2b48922 100644 --- a/src/bin/lttng-relayd/stream.c +++ b/src/bin/lttng-relayd/stream.c @@ -447,6 +447,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 333246afb..ba8abd4eb 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) {