Skip to content

Commit

Permalink
more leak fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Mar 4, 2024
1 parent 619f902 commit e881334
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Source/NSJSONSerialization.m
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,18 @@
{
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;
}

Expand Down Expand Up @@ -549,10 +552,9 @@
if (number != numberBuffer)
{
free(number);
number = numberBuffer;
}
parseError(state);
return nil;
parseError(state);
return nil;
}
BUFFER(c);
while (isdigit(c = consumeChar(state)))
Expand Down Expand Up @@ -1072,7 +1074,9 @@ + (NSData*) dataWithJSONObject: (id)obj
{
if (NULL != error)
{
NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:
NSDictionary *userInfo;

userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
_(@"JSON writing error"), NSLocalizedDescriptionKey,
nil];
*error = [NSError errorWithDomain: NSCocoaErrorDomain
Expand Down

0 comments on commit e881334

Please sign in to comment.