The following leaks:
CFStringRef labelName = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(aMultiRef, indexPath.row));
cell.textLabel.text = (NSString *)labelName;
CFRelease(labelName);
Wondering if there a way to rewrite it so it doesn’t leak without breaking out & assigning ABMultiValueCopyLabelAtIndex(aMultiRef, indexPath.row) to a CFStringRef that I then need to manually CFRelease 2 lines later? Of course, it’s not a big deal to do just that…I’m just curious.
Edit: Would CFAutoRelease work? see my comment below
Because of Copy/Get semantics you are required to release anything that comes out of an API with
Copyin it.ABMultiValueCopyLabelAtIndexmeets that requirement, so unfortunately you’ll need to acquire this reference and release it later on.