[lttng-dev] [PATCH lttng-tools] Fix: Check if pointer is initialized before printing

Jonathan Rajotte jonathan.rajotte-julien at efficios.com
Tue Oct 20 13:58:21 EDT 2015


Prevent a segfault on premature error such arguments parsing error etc.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/bin/lttng-relayd/main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
index 7fc2fb5..eebb552 100644
--- a/src/bin/lttng-relayd/main.c
+++ b/src/bin/lttng-relayd/main.c
@@ -485,9 +485,12 @@ static void print_global_objects(void)
 {
 	rcu_register_thread();
 
-	print_viewer_streams();
-	print_relay_streams();
-	print_sessions();
+	if (viewer_streams_ht)
+		print_viewer_streams();
+	if (relay_streams_ht)
+		print_relay_streams();
+	if (sessions_ht)
+		print_sessions();
 
 	rcu_unregister_thread();
 }
-- 
2.1.4




More information about the lttng-dev mailing list