<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - null ptr deref warning after call to non returning function"
   href="http://llvm.org/bugs/show_bug.cgi?id=22263">22263</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>null ptr deref warning after call to non returning function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nick@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13702" name="attach_13702" title="results of running scan build">attachment 13702</a> <a href="attachment.cgi?id=13702&action=edit" title="results of running scan build">[details]</a></span>
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");
    abort();
  }
}

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

ex:

somevar = my_malloc(some_size);
somevar->member;

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!

[0]
<a href="https://github.com/h2o/h2o/blob/35707d051e30a3a986b66eb317e2c711b221795c/include/h2o/memory.h#L243-L249">https://github.com/h2o/h2o/blob/35707d051e30a3a986b66eb317e2c711b221795c/include/h2o/memory.h#L243-L249</a>
[1]
<a href="https://github.com/h2o/h2o/blob/9cb45394b00f3ca9644ca99ca3d28f96a089835a/lib/common/memory.c#L57-L61">https://github.com/h2o/h2o/blob/9cb45394b00f3ca9644ca99ca3d28f96a089835a/lib/common/memory.c#L57-L61</a>
[2]
<a href="https://github.com/h2o/h2o/blob/9cb45394b00f3ca9644ca99ca3d28f96a089835a/lib/handler/configurator/expires.c#L63-L65">https://github.com/h2o/h2o/blob/9cb45394b00f3ca9644ca99ca3d28f96a089835a/lib/handler/configurator/expires.c#L63-L65</a>
[3] <a href="https://github.com/h2o/h2o/issues/107">https://github.com/h2o/h2o/issues/107</a>
[4] <a href="https://github.com/h2o/h2o/pull/108#issuecomment-70044354">https://github.com/h2o/h2o/pull/108#issuecomment-70044354</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>