Fix: sessiond: Dereference before null check
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 1 Oct 2019 14:35:28 +0000 (10:35 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 4 Oct 2019 19:01:22 +0000 (15:01 -0400)
Coverity report:
  CID 1404933 (#1 of 1): Dereference before null check
  (REVERSE_INULL)check_after_deref: Null-checking
  session->chunk_being_archived suggests that it may be null, but it has
  already been dereferenced on all paths leading to the check.

Reported-by: Coverity (1404933) Dereference before 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 05627f9345d6151e28db2a3534a99c9f1b5d08b9..ee25baaf1964d8d5a1809a2e1bfc53f5f723d1df 100644 (file)
@@ -467,6 +467,11 @@ int check_session_rotation_pending(struct ltt_session *session,
        const char *archived_chunk_name;
        uint64_t chunk_being_archived_id;
 
+       if (!session->chunk_being_archived) {
+               ret = 0;
+               goto end;
+       }
+
        chunk_status = lttng_trace_chunk_get_id(session->chunk_being_archived,
                        &chunk_being_archived_id);
        assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
@@ -474,11 +479,6 @@ int check_session_rotation_pending(struct ltt_session *session,
        DBG("[rotation-thread] Checking for pending rotation on session \"%s\", trace archive %" PRIu64,
                        session->name, chunk_being_archived_id);
 
-       if (!session->chunk_being_archived) {
-               ret = 0;
-               goto end;
-       }
-
        /*
         * The rotation-pending check timer of a session is launched in
         * one-shot mode. If the rotation is incomplete, the rotation
This page took 0.026135 seconds and 4 git commands to generate.