[LLVMbugs] [Bug 8393] New: realloc() modeling error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Oct 17 01:35:04 PDT 2010


           Summary: realloc() modeling error
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: dimhen at gmail.com
                CC: llvmbugs at cs.uiuc.edu

$ clang -v
clang version 2.9 (trunk 116687)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ cat realloc.c
#include <stdlib.h>

void foo()
    char *ptr = malloc(1);
    char *re_ptr;

    re_ptr = realloc( ptr, 2);
    if( re_ptr == NULL ) {
        free( ptr );
    free( re_ptr );
$ clang -cc1 realloc.c -analyze -analyzer-check-objc-mem
realloc.c:10:2: warning: Try to free a memory block that has been released
        free( ptr );
1 warning generated.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list