fix a few leaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38557 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2015-05-26 13:12:41 +00:00
parent 9d6729f4a7
commit efe30f337a
3 changed files with 22 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2015-05-26 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSURLConnection.m: Fix leak of limit date
* Source/NSXMLParser.m: Fix leak of string
2015-05-26: Sebastian Reitenbach <sebastia@l00-bugdead-prods.de>
* Source/Additions/Unicode.m

View file

@ -334,6 +334,7 @@ typedef struct
{
[loop runMode: NSDefaultRunLoopMode beforeDate: limit];
}
[limit release];
if (NO == [collector done])
{
data = nil;

View file

@ -734,7 +734,7 @@ static SEL foundIgnorableSel;
RELEASE(this->tagPath);
RELEASE(this->namespaces);
RELEASE(this->defaults);
[this release];
RELEASE(this);
_parser = 0;
_handler = 0;
}
@ -782,7 +782,7 @@ static SEL foundIgnorableSel;
tmp = [[NSString alloc] initWithData: data encoding: enc];
this->data
= [[tmp dataUsingEncoding: NSUTF8StringEncoding] retain];
[tmp release];
RELEASE(tmp);
}
this->tagPath = [[NSMutableArray alloc] init];
this->namespaces = [[NSMutableArray alloc] init];
@ -1587,6 +1587,7 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
seg = NewUTF8STR(start, ptr - start);
if (nil == seg)
{
[m release];
[self _parseError: @"invalid character in quoted string"
code: NSXMLParserInvalidCharacterError];
return nil;
@ -2008,6 +2009,7 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
if (c != '>')
{
[attributes release];
[tag release];
return [self _parseError: @"<tag/ is missing the >"
code: NSXMLParserGTRequiredError];
}
@ -2024,6 +2026,8 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
c = cget();
if (c != '>')
{
[attributes release];
[tag release];
return [self _parseError:
@"<?tag ...? is missing the >"
code: NSXMLParserGTRequiredError];
@ -2034,6 +2038,8 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
if ([tag isEqualToString: @"?xml"]
&& sp != [this->data bytes])
{
[attributes release];
[tag release];
return [self _parseError: @"bad <?xml > preamble"
code: NSXMLParserDocumentStartError];
}
@ -2062,6 +2068,9 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
#endif
if (!this->acceptHTML && [arg length] == 0)
{
RELEASE(arg);
RELEASE(tag);
RELEASE(attributes);
return [self _parseError: @"empty attribute name"
code: NSXMLParserAttributeNotStartedError];
}
@ -2082,7 +2091,7 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
}
val = [self _newQarg];
[attributes setObject: val forKey: arg];
[val release];
RELEASE(val);
c = cget(); // get character behind qarg value
while (isspace(c))
{
@ -2092,11 +2101,11 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
else // implicit
{
[attributes setObject: @"" forKey: arg];
}
[arg release];
}
RELEASE(arg);
}
[attributes release];
[tag release];
RELEASE(attributes);
RELEASE(tag);
vp = this->cp; // prepare for next value
c = cget(); // skip > and fetch next character
}