diff --git a/ChangeLog b/ChangeLog index 689e3b4cc..10bfc273e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-03-10 Fred Kiefer + + * TextConverters/RTF/RTFConsumer.m + * Source/GSNibLoading.m + * Source/NSInputManager.m + * Source/NSEPSImageRep.m + * Model/GMArchiver.m + * Tools/set_show_service.m + * Tools/GSspell.m: Fix memory leaks found by static analyser. + 2011-03-10 Fred Kiefer * Headers/Additions/GNUstepGUI/GSTitleView.h, diff --git a/Model/GMArchiver.m b/Model/GMArchiver.m index 22c001593..3d8d16949 100644 --- a/Model/GMArchiver.m +++ b/Model/GMArchiver.m @@ -131,7 +131,7 @@ [super dealloc]; } -- (NSString*) newLabel +- (NSString*) nextLabel { return [NSString stringWithFormat: @"Object%5d", ++counter]; } @@ -256,7 +256,7 @@ label = NSHashGet(conditionals, anObject); if (label) { NSHashRemove(conditionals, anObject); - NSMapInsert(objects, anObject, [self newLabel]); + NSMapInsert(objects, anObject, [self nextLabel]); return label; } } @@ -274,7 +274,7 @@ label = name; } else - label = [self newLabel]; + label = [self nextLabel]; NSMapInsert(objects, anObject, label); diff --git a/Source/GSNibLoading.m b/Source/GSNibLoading.m index a6170a6bf..99630f62b 100644 --- a/Source/GSNibLoading.m +++ b/Source/GSNibLoading.m @@ -1474,6 +1474,7 @@ static BOOL _isInInterfaceBuilder = NO; Class newCellClass = [newClass cellClass]; if (newCellClass != [NSCell class]) { + RELEASE(obj); result = [[newCellClass alloc] initWithCoder: coder]; } } diff --git a/Source/NSEPSImageRep.m b/Source/NSEPSImageRep.m index 805e21497..8b6348888 100644 --- a/Source/NSEPSImageRep.m +++ b/Source/NSEPSImageRep.m @@ -74,7 +74,7 @@ // Initializing a New Instance + (id) imageRepWithData: (NSData *)epsData { - return [[self alloc] initWithData: epsData]; + return AUTORELEASE([[self alloc] initWithData: epsData]); } - (id) initWithData: (NSData *)epsData diff --git a/Source/NSInputManager.m b/Source/NSInputManager.m index 3daa43cb3..30aa098ab 100644 --- a/Source/NSInputManager.m +++ b/Source/NSInputManager.m @@ -290,7 +290,7 @@ static NSInputManager *currentInputManager = nil; NSString *c = [NSString stringWithCharacters: &character length: 1]; [description appendString: c]; } - return description; + return AUTORELEASE(description); } - (void) loadBindingsFromFile: (NSString *)fullPath diff --git a/TextConverters/RTF/RTFConsumer.m b/TextConverters/RTF/RTFConsumer.m index 16fd72312..b5af2c567 100644 --- a/TextConverters/RTF/RTFConsumer.m +++ b/TextConverters/RTF/RTFConsumer.m @@ -482,6 +482,7 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c) if (attachment == nil) { NSLog(@"No attachment at %d", oldPosition); + RELEASE(image); return; } diff --git a/Tools/GSspell.m b/Tools/GSspell.m index a2962b5a1..258dc7463 100644 --- a/Tools/GSspell.m +++ b/Tools/GSspell.m @@ -531,6 +531,8 @@ int main(int argc, char** argv) { NSLog(@"Cannot create spell checker instance"); } + RELEASE(aSpellChecker); + RELEASE(aServer); RELEASE(_pool); return 0; } diff --git a/Tools/set_show_service.m b/Tools/set_show_service.m index 7d2de3d35..821ae1439 100644 --- a/Tools/set_show_service.m +++ b/Tools/set_show_service.m @@ -93,6 +93,7 @@ main(int argc, char** argv, char **env) } NSLog(@"Nothing to do.\n"); + RELEASE(pool); return(1); }