Coverity analysis defect 184202: Dereference of potentially null field

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Engines - Foundations
    • None
    • None

      We have this error handling:

      err:
      /* Let any running threads finish up. */
      if (multithreaded) {
      __wt_cond_signal(session, conn->layered_drain_data.threads.wait_cond);
      __wt_writelock(session, &conn->layered_drain_data.threads.lock);
      WT_TRET(__wt_thread_group_destroy(session, &conn->layered_drain_data.threads));
      }

      We set bool multithreaded = conn->layered_drain_data.thread_count > 1; on line 2062, but do not create the thread groups until afterwards. If thread_group_create fails, it may be possible to have a NULL value for threads.wait_cond.
       
      Dereference of potentially null field

      If the field is actually null, then a null pointer dereference will occur. Field, which is statistically checked against null, is dereferenced.
      /src/conn/conn_layered.c:2111: NULL_FIELD 184202 Reading field "wait_cond", which is expected to possibly be "NULL" in "conn->layered_drain_data.threads.wait_cond" (checked 1 out of 13 times).

            Assignee:
            Unassigned
            Reporter:
            Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: