ileak fix

This commit is contained in:
rfm 2024-03-04 10:21:35 +00:00
parent cd2626e26b
commit 619f902e9b
2 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2024-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSJSONSerialization.m: Fix leak reported by Larry Campbell
git issue #377
2024-02-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: Move posting of notification outside lock

View file

@ -211,10 +211,9 @@ updateStreamBuffer(ParserState* state)
n = [stream read: &bytes[1] maxLength: i];
if (n == i)
{
str = [[NSString alloc] initWithUTF8String: (char*)bytes];
str = [NSString stringWithUTF8String: (char*)bytes];
[str getCharacters: state->buffer
range: NSMakeRange(0,1)];
[str release];
}
else
{
@ -278,6 +277,7 @@ updateStreamBuffer(ParserState* state)
state->source = str;
updateStringBuffer(state);
state->source = stream;
RELEASE(str);
}
/**
@ -1146,11 +1146,12 @@ writeObject(id obj, NSMutableString *output, NSInteger tabs)
obj = parseValue(&p);
// Consume any data in the stream that we've failed to read
updateStreamBuffer(&p);
RELEASE(p.source);
if (NULL != error)
{
*error = p.error;
}
return [obj autorelease];
return AUTORELEASE(obj);
}
+ (NSInteger) writeJSONObject: (id)obj