<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 --- - false positive: use of memory after free"
   href="http://llvm.org/bugs/show_bug.cgi?id=17812">17812</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>false positive: use of memory after free
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>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>reif@earthlink.net
          </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>I'm getting a false positive:

$ clang++ --analyze my_free.cpp
my_free.cpp:10:5: warning: Use of memory after it is freed
    printf("leave my_free(%p)\n", memory);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

for this code:

#include <stdio.h>
#include <stdlib.h>

void my_free(void * memory)
{
    printf("enter my_free(%p)\n", memory);

    free(memory);

    printf("leave my_free(%p)\n", memory);
}

int main()
{
    char * m = (char *)malloc(10);

    my_free(m);
}

It's printing the value of the pointer to freed memory but is is not
dereferencing the pointer.</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>