0

When I use Instruments, it complains of a memory leak on emailProperty. Analyzer complains about mobileLabel. The code snippet is below. Given that I use release and CFRelease, is there an obvious reason why it's complaining? Thanks in advance for any responses.

    // Email is a multi value property, take "Home"
ABMultiValueRef emailProperty = ABRecordCopyValue(person, kABPersonEmailProperty);
NSString *email;
NSString *mobileLabel;
for (CFIndex i = 0; i < ABMultiValueGetCount(emailProperty); i++)
{
    mobileLabel = (NSString *)ABMultiValueCopyLabelAtIndex(emailProperty, i);
    if ([mobileLabel isEqualToString:@"_$!<Home>!$_"])
    {
        email = (NSString *)ABMultiValueCopyValueAtIndex(emailProperty,i);
        self.emailAddress.text = email;
        self.emailAddress.enabled = NO;
        self.emailAddress.borderStyle = UITextBorderStyleNone;
        [email release];
        break;
    }
    [mobileLabel release];

}
CFRelease(emailProperty);

1 Answers1

1

I switched from using NSString* to CFString + CFRelease, and that seemed to do the trick. The Analyzer still complains, but it seemed to run fine under Profile -> Leaks.