Memory Leeks from Richard.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2625 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1997-11-12 15:37:27 +00:00
parent 4fbe10eb9e
commit a8f435a6c0
7 changed files with 33 additions and 24 deletions

View file

@ -1,3 +1,23 @@
Wed Nov 12 10:10:33 1997 Adam Fedor <fedor@doc.com>
* src/NSString.m (-initWithFormat:args:): Print a "null string"
when string in format is nil.
* src/objc-load.c: Remove ifdef HAVE_CONFIG_H.
Wed Nov 12 12:30:00 1997 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/Collection.m: ([Enumerator -dealloc]) added call dealloction
method in super class to fix memory leak.
* src/KeyedCollection.m: Removed initialisation and deallocation
methods for KeyEnumerator as these are done in its super class.
* src/NSCharacterSet.m: ([-invertedSet:]) added autorelease for data
object (created by mutableCopy) in order to fix memory leak.
* src/NSData.m: Replaced line accidentally deleted in section only
compiled in for systems without shared memory.
Thu Nov 6 19:00:00 1997 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Tools/Makefile.postamble: Modified to install gdomap in cpu/os

View file

@ -34,8 +34,12 @@
- initWithCollection: coll
{
collection = [coll retain];
enum_state = [coll newEnumState];
self = [super init];
if (self)
{
collection = [coll retain];
enum_state = [coll newEnumState];
}
return self;
}
@ -48,6 +52,7 @@
{
[collection freeEnumState: &enum_state];
[collection release];
[super dealloc];
}
@end

View file

@ -31,13 +31,6 @@
@implementation KeyEnumerator
- initWithCollection: coll
{
collection = [coll retain];
enum_state = [coll newEnumState];
return self;
}
- nextObject
{
id k;
@ -45,17 +38,6 @@
return k;
}
- (void) dealloc
{
[collection freeEnumState: &enum_state];
[collection release];
/* xxx
* I don't understand this - but calling [super dealloc] screws up
* so we use NSDeallocateObject() instead.
*/
NSDeallocateObject(self);
}
@end
@implementation ConstantKeyedCollection

View file

@ -311,8 +311,9 @@ static NSLock* cache_lock = nil;
{
int i, length;
char *bytes;
NSMutableData *bitmap = [[self bitmapRepresentation] mutableCopy];
NSMutableData *bitmap;
bitmap = [[[self bitmapRepresentation] mutableCopy] autorelease];
length = [bitmap length];
bytes = [bitmap mutableBytes];
for (i=0; i < length; i++)

View file

@ -774,6 +774,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
autorelease];
#else
return [[[NSDataMalloc alloc] initWithBytes:bytes length:length]
autorelease];
#endif
}

View file

@ -427,6 +427,8 @@ handle_printf_atsign (FILE *stream,
}
/* Get a C-string (char*) from the String object, and print it. */
cstring = [[(id) va_arg (arg_list, id) description] cStringNoCopy];
if (!cstring)
cstring = "<null string>";
strcat (buf+printed_len, cstring);
printed_len += strlen (cstring);
/* Skip over this `%@', and look for another one. */

View file

@ -33,9 +33,7 @@
#include <stdlib.h>
#include <objc/objc-api.h>
#include <objc/objc-list.h>
#ifdef HAVE_CONFIG_H
#include <gnustep/base/config.h>
#endif
#include <config.h>
#include <Foundation/objc-load.h>
/* include the interface to the dynamic linker */