From: Jérémie Galarneau Date: Mon, 9 Sep 2019 14:22:58 +0000 (-0400) Subject: Fix relayd: check for NULL in session_put X-Git-Tag: v2.11.0-rc4~84 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2b847234774ea3cb6999ae9b2e6a1c4c9b2188dd;p=lttng-tools.git Fix relayd: check for NULL in session_put The session and relay daemons both define their own "session" APIs (ltt_session and relay_session) which define a session_put() function. Coverity reports that a fair amount of callers now assume that session_put() assumes that a NULL check is performed (as in the sessiond). Since the session daemon's variant checks for NULL, it makes sense to bring both implementation to parity to fix the problems reported and make this function less confusing to use. This also allows simplifications to the error handling paths in the relay daemon (not included in this patch). Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/session.c b/src/bin/lttng-relayd/session.c index af2278d46..827746430 100644 --- a/src/bin/lttng-relayd/session.c +++ b/src/bin/lttng-relayd/session.c @@ -389,6 +389,9 @@ void session_release(struct urcu_ref *ref) void session_put(struct relay_session *session) { + if (!session) { + return; + } rcu_read_lock(); urcu_ref_put(&session->ref, session_release); rcu_read_unlock();