EDIT: Sorry for my question. It turned out that the error was in the line before the one that was flagged by the static analyzer.
In this line, I called a Obj-C method that creates and returns an ABRecordRef
, and although I balanced the creation of the CF object by a CFRelease
in the calling code, the static analyzer was apparently not sure if the memory management of the CF object was done correctly, thus the "potential leak".
I converted the method to a C function, and the warning is gone.
ORIGINAL QUESTION:
Under ARC, I have a subclass of a UINavigationController
that is presented modally.
In the viewDidLoad
method, I set up an ABNewPersonViewController
, and present it by pushing it onto the navigation stack, using the following code:
ABNewPersonViewController *personViewController = [[ABNewPersonViewController alloc] initWithNibName:nil bundle:nil];
personViewController.newPersonViewDelegate = self;
personViewController.displayedPerson = self.contactToBeAdded;f
[self pushViewController:personViewController animated:NO];
Everything works fine, but the static analyzer gives, at the 1st line of the code, the warning "Memory (Core Foundation/Objective-C) Potential leak of an object".
I don't understand why there is this warning, and how I could get rid of it.
Any suggestion?