From 6ae1bf4602f7bfd3a1a206aaf98295191cef5082 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Tue, 1 Oct 2019 10:19:49 -0400 Subject: [PATCH] Fix: sessiond: Dereference after null check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Coverity report: CID 1404943 (#1 of 1): Dereference after null check (FORWARD_NULL)9. var_deref_model: Passing null pointer session->chunk_being_archived to lttng_trace_chunk_get_id, which dereferences it. Reported-by: Coverity (1404943) Dereference after null check Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/rotation-thread.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng-sessiond/rotation-thread.c b/src/bin/lttng-sessiond/rotation-thread.c index 2b44036a2..05627f934 100644 --- a/src/bin/lttng-sessiond/rotation-thread.c +++ b/src/bin/lttng-sessiond/rotation-thread.c @@ -489,14 +489,14 @@ int check_session_rotation_pending(struct ltt_session *session, */ ret = timer_session_rotation_pending_check_stop(session); if (ret) { - goto end; + goto check_ongoing_rotation; } check_session_rotation_pending_on_consumers(session, &rotation_completed); if (!rotation_completed || session->rotation_state == LTTNG_ROTATION_STATE_ERROR) { - goto end; + goto check_ongoing_rotation; } /* @@ -562,7 +562,7 @@ int check_session_rotation_pending(struct ltt_session *session, } ret = 0; -end: +check_ongoing_rotation: if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING) { uint64_t chunk_being_archived_id; @@ -582,6 +582,7 @@ end: } } +end: return ret; } -- 2.34.1