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

Coverity 1352899: Dereference before null check

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.8.0
    • Component/s: None
    • Labels:
      None

      Description

      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 }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                keith.bostic Keith Bostic
                Reporter:
                keith.bostic Keith Bostic
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: