<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 --- - scan-build does not recognize custom malloc/free based on dlmalloc"
   href="http://llvm.org/bugs/show_bug.cgi?id=22237">22237</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>scan-build does not recognize custom malloc/free based on dlmalloc
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>simon.brandner@gmail.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>We use our own set of allocation routines.
They are called dr_malloc and dr_free, and are wrappers of a statically linked
version of dlmalloc (<a href="http://g.oswego.edu/dl/html/malloc.html">http://g.oswego.edu/dl/html/malloc.html</a>).

I intentionally did remove a valid dr_free to see if the problem is detected by
scan-build, but nothing was reported.
This is somehow related to #14819, but I do not find any hints how to annotate
a malloc/free to tell clang which routines do replace normal malloc.

There is also a mailinglist thread requesting such a feature:
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-users/2013-July/000166.html">http://lists.cs.uiuc.edu/pipermail/cfe-users/2013-July/000166.html</a>

It seems it did not end up in a feature request here.

So if it does not exist, a feature to indicate to clang/scan-build which
functions replace malloc/calloc/free so it can run its static analysis on them
would be a great enhancement.</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>