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

           Summary: Static analyzer false positive with
                    IORegistryEntrySearchCFProperty()
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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,
                                                          kIOServicePlane,
                                                         
CFSTR("IOConsoleUsers"),
                                                          NULL,
                                                         
kIORegistryIterateRecursively);
    if (arrayRef != NULL)
    {
        CFRelease(arrayRef);
    }

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

Reply via email to