[LLVMbugs] [Bug 12100] New: "NoCopy" methods and functions should assume ownership of malloc'd bytes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 27 09:18:31 PST 2012


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

             Bug #: 12100
           Summary: "NoCopy" methods and functions should assume ownership
                    of malloc'd bytes
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: tjw at me.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8103
  --> http://llvm.org/bugs/attachment.cgi?id=8103
example

The new malloc lifecycle checks hit false positives with the "NoCopy" CF/NS
functions and methods. In the case of the CF functions, the transfer only
happens if the CFAllocatorRef passed is kCFAllocatorMalloc (or possibly
anything but kCFAllocatorNull).

Passing kCFAllocatorNull might indicate an unintentional leak (especially since
Xcode likes to autocomplete "kCFAll" to the Null variant), but it might also
indicate that the caller is doing something special (like making several data
objects out of one buffer -- maybe read from a file or owned by another data,
or...). Some indication in the source that this is going on, but I don't have a
good idea for what that would be right now =)

See the example for a few of the functions/methods that hit this, and a list of
several more.

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