stig/json-framework — Issue #116: Memory leak in NSObject+JSON
Author: enricodetoma
Created: 2011-12-17 21:12:07+00:00
State: open

There are 2 memory leaks in NSObject+JSON, indicated by "==>" (autorelease is missing):

```objective-c
- (NSString *)JSONRepresentation {
==> SBJsonWriter *writer = [[SBJsonWriter alloc] init];
NSString *json = [writer stringWithObject:self];
if (!json)
NSLog(@"-JSONRepresentation failed. Error is: %@", writer.error);
return json;
}

...

- (id)JSONValue {
==> SBJsonParser *parser = [[SBJsonParser alloc] init]; **
id repr = [parser objectWithString:self];
if (!repr)
NSLog(@"-JSONValue failed. Error is: %@", parser.error);
return repr;
}
```