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 23:27:43 +0000 (18:27 -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 2300e5f1adab5c6c2190af4829cb9c2767f3e2f3..c2bf0f403148621cfa001342b53aae0c7b0e21ab 100644 (file)
@@ -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) {
index 8825d094ce57b389662667bfd5d567ca0ed77cfd..9d2b4892207c32a59d526625cccd1077bffdc40b 100644 (file)
@@ -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) {
index 333246afb3f4d312874cca9cfc144e6cc0fdf932..ba8abd4ebf7e227ee07b8b6db77acdacb2f1b0c2 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.027222 seconds and 4 git commands to generate.