[LLVMbugs] [Bug 12072] New: malloc/free checker false positive in -[NSData dataWithBytesNoCopy:length:freeWhenDone:]

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 23 22:55:17 PST 2012


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

             Bug #: 12072
           Summary: malloc/free checker false positive in -[NSData
                    dataWithBytesNoCopy:length:freeWhenDone:]
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: nikita at zhuk.fi
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Test case:

void *bytes = malloc(1024);
[NSData dataWithBytesNoCopy:bytes length:1024 freeWhenDone:YES];

checker-261 reports:
"Memory is never released, potential memory leak".

This is incorrect, since if "freeWhenDone" flag is set to YES, NSData instance
takes ownership of the bytes pointer and frees it on deallocation.

-- 
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