more leak fixes

This commit is contained in:
rfm 2024-03-04 10:49:58 +00:00
parent 619f902e9b
commit e8813346e5

View file

@ -474,15 +474,18 @@ parseString(ParserState *state)
{
val = [NSMutableString new];
}
// Consume the trailing "
consumeChar(state);
if (!state->mutableStrings)
{
if (NO == [val makeImmutable])
{
val = [val copy];
NSString *str = [val copy];
RELEASE(val);
return str;
}
}
// Consume the trailing "
consumeChar(state);
return val;
}
@ -549,7 +552,6 @@ parseNumber(ParserState *state)
if (number != numberBuffer)
{
free(number);
number = numberBuffer;
}
parseError(state);
return nil;
@ -1072,7 +1074,9 @@ writeObject(id obj, NSMutableString *output, NSInteger tabs)
{
if (NULL != error)
{
NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:
NSDictionary *userInfo;
userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
_(@"JSON writing error"), NSLocalizedDescriptionKey,
nil];
*error = [NSError errorWithDomain: NSCocoaErrorDomain