ie:
boolRef = (CFBooleanRef)CFDictionaryGetValue(descriptionDictionary, kDADiskDescriptionMediaRemovableKey);
if (boolRef) {
CFRelease(boolRef); // do i need this code?
}
ie:
boolRef = (CFBooleanRef)CFDictionaryGetValue(descriptionDictionary, kDADiskDescriptionMediaRemovableKey);
if (boolRef) {
CFRelease(boolRef); // do i need this code?
}
First read the Memory Management Programming Guide for Core Foundation. The answer is no, because of the Create Rule. CFDictionaryGetValue()
does not include the words "Create" or "Copy."
Note that CFRelease()
in this case is not just unneeded, it is incorrect and will lead to an over-release crash.