1

I'm using JSONKit in my app, but when I click analyze in Xcode I get 2 issues in JSONKit.m:

Issue 1:

Issue 1

Issue 2:

Issue 2

Should I do something about this?

Gustaf Rosenblad
  • 1,902
  • 2
  • 25
  • 45
  • 1
    Why are you using JSONKit? If you are targeting iOS 5.0 onwards, you can use NSJSONSerialization, right? The issue which it is showing is that array and dictionary are both allocated but not released outside the if condition. You might have to keep an autorelease outside the if condition. – iDev Nov 01 '12 at 19:27
  • 1
    I'm can't use NSJSONSerialization because I need to support iOS 4.0 – Gustaf Rosenblad Nov 01 '12 at 19:50

1 Answers1

2

I would imagine that those aren't actual memory leaks. Both methods have 'Create' in their name which I think is meant to follow the Core Foundation create rule. I would guess that the analyser is just applying the Objective-C convention where only variants 'new', 'alloc', 'copy' and 'retain' are supposed to return owning references.

Those are clear C functions rather than Objective-C methods; I guess the analyser is applying Objective-C rules because Objective-C objects are being returned, albeit confusingly because the normal conventions are being deliberately ignored.

Tommy
  • 99,986
  • 12
  • 185
  • 204