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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to