[LLVMbugs] [Bug 10621] New: Static analyzer false positive with IORegistryEntrySearchCFProperty()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 9 14:22:04 PDT 2011


           Summary: Static analyzer false positive with
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: sean at rogue-research.com
                CC: llvmbugs at cs.uiuc.edu

The static analyzer reports "Incorrect decrement of the reference count of an
object that is not owned at this point by the caller" for the snippet below:

#import <CoreFoundation/CoreFoundation.h>
#import <IOKit/IOKitLib.h>

int main (void)
    CFArrayRef arrayRef = IORegistryEntrySearchCFProperty(0,
    if (arrayRef != NULL)

    return 0;

But the docs for IORegistryEntrySearchCFProperty() say: "Return Value - A CF
container is created and returned the caller on success. The caller should
release with CFRelease".

The API doesn't have Create or Copy in it's name, which I guess is also a bug,
and perhaps the root cause of this bug.

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