Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-2465

Coverity 1352899: Dereference before null check

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • WT2.8.0
    • Affects Version/s: None
    • Component/s: None
    • None

      415 static inline char *
      416 dstrndup(const char *str, const size_t len)
      417 {
      418        char *p;
      419        p = dcalloc(len + 1, 1);
      420
         	deref_ptr_in_call: Dereferencing pointer p.
      421        strncpy(p, str, len);
         	
      CID 1352899 (#1 of 1): Dereference before null check (REVERSE_INULL)
      check_after_deref: Null-checking p suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
      422        if (p == NULL)
      423                die(errno, "dstrndup");
      424        return (p);
      425 }
      

            Assignee:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Reporter:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: