Skip to content

Commit

Permalink
Fix another leak
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Nov 20, 2024
1 parent 92ef562 commit 9189f1b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Tools/AGSParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -1486,8 +1486,8 @@ - (void) parseDeclaratorInto: (NSMutableDictionary*)d

- (NSMutableArray*) parseDeclarations
{
IF_NO_ARC(NSAutoreleasePool *arp = [NSAutoreleasePool new];)
NSMutableArray *declarations = [NSMutableArray array];
CREATE_AUTORELEASE_POOL(arp);
static NSSet *qualifiers = nil;
static NSSet *keep = nil;
NSString *baseName = nil;
Expand Down Expand Up @@ -1516,7 +1516,7 @@ - (NSMutableArray*) parseDeclarations
@"unsigned",
@"volatile",
nil];
IF_NO_ARC([qualifiers retain];)
IF_NO_ARC(qualifiers = [qualifiers retain];)
keep = [NSSet setWithObjects:
@"const",
@"long",
Expand All @@ -1525,7 +1525,7 @@ - (NSMutableArray*) parseDeclarations
@"unsigned",
@"volatile",
nil];
IF_NO_ARC([keep retain];)
IF_NO_ARC(keep = [keep retain];)
}

{
Expand Down Expand Up @@ -1573,7 +1573,7 @@ - (NSMutableArray*) parseDeclarations
pos++;
[self skipSpaces];
}
IF_NO_ARC(DESTROY(arp);)
IF_NO_ARC([arp release];)
return nil;
}

Expand Down Expand Up @@ -1644,7 +1644,7 @@ - (NSMutableArray*) parseDeclarations
if (NO == isEnum)
{
[self log: @"messed up NS_ENUM/NS_OPTIONS declaration"];
[arp drain];
IF_NO_ARC([arp release];)
return nil;
}
}
Expand Down Expand Up @@ -2008,8 +2008,8 @@ - (NSMutableArray*) parseDeclarations
{
if (buffer[pos] == ')' || buffer[pos] == ',')
{
[arp drain];
return declarations;
IF_NO_ARC(declarations = [declarations retain]; [arp release];)
return AUTORELEASE(declarations);
}
else
{
Expand Down Expand Up @@ -2131,7 +2131,6 @@ - (NSMutableArray*) parseDeclarations
}
DESTROY(comment);

[arp drain];
if (inArgList == NO)
{
/*
Expand All @@ -2149,19 +2148,21 @@ - (NSMutableArray*) parseDeclarations
{
[self log: @"parse declaration with no name - %@", d];
}
IF_NO_ARC([arp release];)
return nil;
}
}
[self setStandards: declarations];
return declarations;
IF_NO_ARC(declarations = [declarations retain]; [arp release];)
return AUTORELEASE(declarations);
}
else
{
[self log: @"unexpected end of data parsing declaration"];
}
fail:
DESTROY(comment);
[arp drain];
IF_NO_ARC([arp release];)
return nil;
}

Expand Down

0 comments on commit 9189f1b

Please sign in to comment.