honcheng/iOSPlot

Memory leak in PCPieChart.m

lucianoenrico opened this issue · 1 comments

Hi,
the static analyzer complains about this release

- (void)dealloc
{
    [self.titleFont release];  // THIS RELEASE
    [self.percentageFont release];
    [self.components release];
    [super dealloc];
}

By design (Apple documentation):

You do not create UIFont objects using the alloc and init methods. Instead, you use class methods of UIFont to look up and retrieve the desired font object. These methods check for an existing font object with the specified characteristics and return it if it exists. Otherwise, they create a new font object based on the desired font characteristics.

With this caching mechanism in place you think you don't need to retain the font in the first place?

Fixed