Fix: sessiond: Dereference after null check
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 1 Oct 2019 14:19:49 +0000 (10:19 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 4 Oct 2019 19:00:13 +0000 (15:00 -0400)
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 <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/rotation-thread.c

index 2b44036a2276c224b108fd26760d3063770660c9..05627f9345d6151e28db2a3534a99c9f1b5d08b9 100644 (file)
@@ -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;
 }
 
This page took 0.027093 seconds and 4 git commands to generate.