leak fixing

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32035 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-02-10 12:11:03 +00:00
parent 67df51138c
commit f3a58fb845
10 changed files with 36 additions and 18 deletions

View file

@ -1,3 +1,15 @@
2011-02-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSpellServer.m: Avoid compiler warning.
* Source/NSPathUtilities.m:
* Source/NSMessagePortNameServer.m:
* Source/NSKeyValueObserving.m:
* Source/NSURLProtocol.m:
* Source/NSString.m:
* Source/NSNumberFormatter.m:
* Source/NSXMLParser.m:
Fix memory leaks
2011-02-10 11:02 David Chisnall <theraven@gna.org>
* libs/base/trunk/Headers/Additions/GNUstepBase/GSMime.h,

View file

@ -359,7 +359,7 @@ static NSString *newKey(SEL _cmd)
u = uni_tolower(u);
tmp = [[NSString alloc] initWithCharacters: &u length: 1];
[m replaceCharactersInRange: NSMakeRange(0, 1) withString: tmp];
RELEASE(tmp);
[tmp release];
key = m;
}
return key;
@ -455,6 +455,7 @@ replacementForClass(Class c)
tmp = [[NSString alloc] initWithCharacters: &u length: 1];
a[0] = [NSString stringWithFormat: @"set%@%@:", tmp, suffix];
a[1] = [NSString stringWithFormat: @"_set%@%@:", tmp, suffix];
[tmp release];
for (i = 0; i < 2; i++)
{
/*

View file

@ -472,7 +472,9 @@ static void clean_up_names(void)
RELEASE(a);
}
[a addObject: [name copy]];
name = [name copy];
[a addObject: name];
[name release];
[serverLock unlock];
[dl unlock];

View file

@ -950,7 +950,8 @@ static NSUInteger _defaultBehavior = 0;
intPartRange.length++;
}
}
intPad = [[useFormat substringWithRange: intPartRange] mutableCopy];
intPad = [[[useFormat substringWithRange: intPartRange]
mutableCopy] autorelease];
[intPad replaceOccurrencesOfString: defaultThousandsSeparator
withString: @""
options: 0

View file

@ -1400,8 +1400,8 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict,
if (wantVal == YES)
{
[dict setObject: @"" forKey: key];
DESTROY(key);
}
DESTROY(key);
NSZoneFree(NSDefaultMallocZone(), src);
NSZoneFree(NSDefaultMallocZone(), dst);
return YES;

View file

@ -44,6 +44,8 @@ NSString *const NSGrammarRange = @"NSGrammarRange";
NSString *const NSGrammarUserDescription = @"NSGrammarUserDescription";
NSString *const NSGrammarCorrections = @"NSGrammarCorrections";
static NSConnection *spellServerConnection = nil;
/* User dictionary location */
static NSString *GNU_UserDictionariesDir = @"Dictionaries";
@ -111,7 +113,6 @@ GSSpellServerName(NSString *vendor, NSString *language)
byVendor: (NSString *)vendor
{
NSString *serverName = GSSpellServerName(vendor, language);
NSConnection *connection = nil;
BOOL result = NO;
if (serverName == nil)
@ -119,12 +120,11 @@ GSSpellServerName(NSString *vendor, NSString *language)
return NO;
}
connection = [[NSConnection alloc] init];
if (connection)
spellServerConnection = [[NSConnection alloc] init];
if (spellServerConnection)
{
IF_NO_GC(RETAIN(connection);)
[connection setRootObject: self];
result = [connection registerName: serverName];
[spellServerConnection setRootObject: self];
result = [spellServerConnection registerName: serverName];
}
return result;

View file

@ -125,6 +125,7 @@ static SEL cMemberSel = 0;
#define IS_BIT_SET(a,i) ((((a) & (1<<(i)))) > 0)
static NSData *whitespaceBitmap;
static unsigned const char *whitespaceBitmapRep = NULL;
#define GS_IS_WHITESPACE(X) IS_BIT_SET(whitespaceBitmapRep[(X)/8], (X) % 8)
@ -133,7 +134,6 @@ static void setupWhitespace(void)
if (whitespaceBitmapRep == NULL)
{
NSCharacterSet *whitespace;
NSData *bitmap;
/*
We can not use whitespaceAndNewlineCharacterSet here as this would lead
@ -143,8 +143,8 @@ static void setupWhitespace(void)
whitespace = [NSCharacterSet characterSetWithCharactersInString:
@" \t\r\n\f\b"];
bitmap = RETAIN([whitespace bitmapRepresentation]);
whitespaceBitmapRep = [bitmap bytes];
whitespaceBitmap = RETAIN([whitespace bitmapRepresentation]);
whitespaceBitmapRep = [whitespaceBitmap bytes];
}
}

View file

@ -669,7 +669,7 @@ static NSURLProtocol *placeholder = nil;
{
NSMutableURLRequest *request;
request = [this->request mutableCopy];
request = [[this->request mutableCopy] autorelease];
[request setURL: url];
[this->client URLProtocol: self
wasRedirectedToRequest: request
@ -922,7 +922,7 @@ static NSURLProtocol *placeholder = nil;
{
NSMutableURLRequest *request;
request = [this->request mutableCopy];
request = [[this->request mutableCopy] autorelease];
[request setURL: url];
[this->client URLProtocol: self
wasRedirectedToRequest: request

View file

@ -759,7 +759,8 @@ static SEL foundIgnorableSel;
NSString *tmp;
tmp = [[NSString alloc] initWithData: data encoding: enc];
data = [[tmp dataUsingEncoding: NSUTF8StringEncoding] retain];
this->data
= [[tmp dataUsingEncoding: NSUTF8StringEncoding] retain];
[tmp release];
}
this->tagPath = [[NSMutableArray alloc] init];
@ -1821,6 +1822,7 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
c = cget();
if (c != '>')
{
[attributes release];
return [self _parseError: @"<tag/ is missing the >"
code: NSXMLParserGTRequiredError];
}

View file

@ -874,7 +874,7 @@ static int verbose = 0;
NSString *filename;
e = [HTMLDirectoryEnumerator alloc];
e = [e initWithBasePath: pathOnDisk];
e = [[e initWithBasePath: pathOnDisk] autorelease];
[e setReturnsAbsolutePaths: YES];
while ((filename = [e nextObject]) != nil)
@ -1056,7 +1056,7 @@ build_relocation_table_for_directory (NSString *dir)
IF_NO_GC ([relocationTable autorelease];)
e = [HTMLDirectoryEnumerator alloc];
e = [e initWithBasePath: dir];
e = [[e initWithBasePath: dir] autorelease];
/* The relocation table for a directory is relative to the
directory top, so that the whole directory can be moved
around without having to regenerate the .htmlink file. */