mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Return nil when initializing a bundle with a non-existing or non-readable
path; fixed memory leak for nil path during init git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12759 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b0b2b38979
commit
092e1d508e
1 changed files with 4 additions and 3 deletions
|
@ -706,13 +706,14 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (!path || [path length] == 0)
|
||||
{
|
||||
NSLog(@"No path specified for bundle");
|
||||
[self dealloc];
|
||||
return nil;
|
||||
}
|
||||
if ([path isAbsolutePath] == NO)
|
||||
{
|
||||
NSLog(@"WARNING: NSBundle -initWithPath: requires absolute path names!");
|
||||
path = [[[NSFileManager defaultManager] currentDirectoryPath]
|
||||
stringByAppendingPathComponent: path];
|
||||
stringByAppendingPathComponent: path];
|
||||
}
|
||||
|
||||
/* Check if we were already initialized for this directory */
|
||||
|
@ -746,8 +747,8 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (bundle_directory_readable(path) == NO)
|
||||
{
|
||||
NSDebugMLLog(@"NSBundle", @"Could not access path %@ for bundle", path);
|
||||
//[self dealloc];
|
||||
//return nil;
|
||||
[self dealloc];
|
||||
return nil;
|
||||
}
|
||||
|
||||
_path = [path copy];
|
||||
|
|
Loading…
Reference in a new issue