[LLVMbugs] [Bug 22263] New: null ptr deref warning after call to non returning function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 19 11:13:14 PST 2015


            Bug ID: 22263
           Summary: null ptr deref warning after call to non returning
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: nick at mozilla.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13702
  --> http://llvm.org/bugs/attachment.cgi?id=13702&action=edit
results of running scan build

Using checker-276, we have code that basically handles our own memory
allocations [0], something like [1]:

void * my_malloc (size_t sz) {
  void * p = malloc(sz);
  if (p == NULL) {
    fprintf(stderr, "out of memeory");

Now, throughout our code we have instances where we get warnings about null
pointer derefs right after calling this function [2].


somevar = my_malloc(some_size);

And we'll get a warning about a possible pointer dereference from the second
statement.  This isn't right, because the allocation function checks if null
then aborts the process.

Please see [3] and [4] for more info.  Thanks!

[3] https://github.com/h2o/h2o/issues/107
[4] https://github.com/h2o/h2o/pull/108#issuecomment-70044354

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150119/ac41f1c3/attachment.html>

More information about the llvm-bugs mailing list