[LLVMbugs] [Bug 17812] New: false positive: use of memory after free

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 5 04:09:31 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=17812

            Bug ID: 17812
           Summary: false positive: use of memory after free
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: reif at earthlink.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
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/20131105/0bc3ad6a/attachment.html>


More information about the llvm-bugs mailing list