mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-14 23:51:14 +00:00
Fix memory management bugs in Steptalk detected by clang's static analyzer
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@34729 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
63f3940bee
commit
939fecc187
14 changed files with 43 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
|||
2012-02-07 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/STTranscript.m (-showError:): Fix space leak detected by clang.
|
||||
|
||||
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/STScriptsPanel.m (-selectScript:): Validate Run button of the
|
||||
|
|
|
@ -134,6 +134,8 @@ static NSDictionary *normalTextAttributes;
|
|||
attributes:errorTextAttributes];
|
||||
[textView insertText:astring];
|
||||
|
||||
RELEASE(astring);
|
||||
|
||||
astring = [[NSAttributedString alloc] initWithString:@"\n"
|
||||
attributes:normalTextAttributes];
|
||||
[textView insertText:astring];
|
||||
|
|
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2012-02-07 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Frameworks/StepTalk/STEnvironment.m (-registerObjectFinderNamed:):
|
||||
* Frameworks/StepTalk/STEnvironmentDescription.m
|
||||
(-updateFromDictionary:, -updateBehavioursFromDictionary:,
|
||||
-updateClassWithName:description:):
|
||||
* Frameworks/StepTalk/STFileScript.m (-source):
|
||||
* Frameworks/StepTalk/STObjCRuntime.m (STAllObjectiveCSelectors):
|
||||
* Tools/STExecutor.m (-executeScript:withArguments:):
|
||||
* Tools/stalk.m (-createConversation, main):
|
||||
* Tools/stenvironment.m (main): Fix potential space leaks detected
|
||||
by clang.
|
||||
|
||||
* Frameworks/StepTalk/STBundleInfo.m (+stepTalkBundleNames): Fix
|
||||
double release detected by clang.
|
||||
|
||||
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Frameworks/StepTalk/STStructure.h:
|
||||
|
|
|
@ -82,7 +82,7 @@ static NSMutableDictionary *bundleInfoDict;
|
|||
[names addObject:name];
|
||||
}
|
||||
|
||||
return AUTORELEASE([NSArray arrayWithArray:names]);
|
||||
return [NSArray arrayWithArray:names];
|
||||
}
|
||||
|
||||
+ stepTalkBundleWithName:(NSString *)moduleName
|
||||
|
|
|
@ -508,6 +508,7 @@ STEnvironment *sharedEnvironment = nil;
|
|||
}
|
||||
|
||||
[self registerObjectFinder:finder name:name];
|
||||
[finder release];
|
||||
}
|
||||
|
||||
/** Remove object finder with name <var>name</var> */
|
||||
|
|
|
@ -157,7 +157,7 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
|
||||
- (void)updateFromDictionary:(NSDictionary *)def
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSAutoreleasePool *pool;
|
||||
NSString *str;
|
||||
BOOL saveFlag = restriction;
|
||||
|
||||
|
@ -167,6 +167,7 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
return;
|
||||
};
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
str = [def objectForKey:@"DefaultRestriction"];
|
||||
|
||||
if(str)
|
||||
|
@ -186,7 +187,6 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
[NSException raise:STGenericException
|
||||
format:@"Invalid default restriction rule '%@'.",
|
||||
str];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,6 +317,7 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
|
||||
behInfo = [[STBehaviourInfo alloc] initWithName:name];
|
||||
[behaviours setObject:behInfo forKey:name];
|
||||
[behInfo release];
|
||||
|
||||
[self updateBehaviour:behInfo description:[dict objectForKey:name]];
|
||||
}
|
||||
|
@ -389,6 +390,7 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
{
|
||||
class = [[STClassInfo alloc] initWithName:className];
|
||||
[classes setObject:class forKey:className];
|
||||
[class release];
|
||||
newClass = YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
source = [[NSString alloc] initWithContentsOfFile:fileName];
|
||||
}
|
||||
*/
|
||||
return [[NSString alloc] initWithContentsOfFile:fileName];
|
||||
return [NSString stringWithContentsOfFile:fileName];
|
||||
}
|
||||
|
||||
/** Returns a script name by which the script is identified */
|
||||
|
|
|
@ -260,7 +260,7 @@ NSArray *STAllObjectiveCSelectors(void)
|
|||
Method *methods;
|
||||
Class *classes;
|
||||
|
||||
array = [[NSMutableArray alloc] init];
|
||||
array = [NSMutableArray array];
|
||||
|
||||
numClasses = objc_getClassList(NULL, 0);
|
||||
classes = (Class *)NSZoneMalloc(STMallocZone, numClasses * sizeof(Class));
|
||||
|
@ -287,7 +287,7 @@ NSArray *STAllObjectiveCSelectors(void)
|
|||
NSZoneFree(STMallocZone, classes);
|
||||
|
||||
/* get rid of duplicates */
|
||||
array = (NSMutableArray *)[[NSSet setWithArray:(NSArray *)array] allObjects];
|
||||
array = (NSMutableArray *)[[NSSet setWithArray:array] allObjects];
|
||||
array = (NSMutableArray *)[array sortedArrayUsingSelector:@selector(compare:)];
|
||||
|
||||
return array;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2012-02-07 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* STCompiledScript.m (-executedInEnvironment:):
|
||||
* STSmalltalkScriptObject.m (-forwardInvocation:):
|
||||
Fix potential space leak detected by clang.
|
||||
|
||||
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* STCompiledScript.m (+initialize, -executeInEnvironment:): Rename
|
||||
|
|
|
@ -104,7 +104,6 @@ static SEL finalizeSelector;
|
|||
if(methodCount == 0)
|
||||
{
|
||||
NSLog(@"Empty script executed");
|
||||
return nil;
|
||||
}
|
||||
else if(methodCount == 1)
|
||||
{
|
||||
|
@ -118,7 +117,6 @@ static SEL finalizeSelector;
|
|||
else if(![object respondsToSelector:mainSelector])
|
||||
{
|
||||
NSLog(@"No 'main' method found");
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
if([methodName isEqualToString:@"exit"])
|
||||
{
|
||||
[interpreter halt];
|
||||
[pool release];
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -199,6 +199,7 @@ const char *STExecutorCommonOptions =
|
|||
|
||||
/* Try to find it in standard script locations */
|
||||
sm = [[STScriptsManager alloc] initWithDomainName:@"Shell"];
|
||||
AUTORELEASE(sm);
|
||||
|
||||
script = [sm scriptWithName:file];
|
||||
source = [script source];
|
||||
|
|
|
@ -112,8 +112,6 @@
|
|||
return;
|
||||
}
|
||||
|
||||
RETAIN(env);
|
||||
|
||||
[env setObject:target forName:objectName];
|
||||
|
||||
conversation = [[STConversation alloc] initWithContext:env
|
||||
|
@ -182,6 +180,7 @@ int main(int argc, const char **argv)
|
|||
NSLog(@"Warning: This tool is obsolete.");
|
||||
[executor runWithArguments:args];
|
||||
|
||||
[executor release];
|
||||
[pool release];
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -168,7 +168,9 @@ int main(int argc, const char **argv)
|
|||
{
|
||||
NSLog(@"Unable to register environment '%@'.", envIdentifier);
|
||||
}
|
||||
|
||||
|
||||
RELEASE(connection);
|
||||
RELEASE(envprocess);
|
||||
RELEASE(pool);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue