mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Fixed memory leak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3011 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
97b63e32f5
commit
2f1b6e455d
1 changed files with 9 additions and 4 deletions
|
@ -25,7 +25,6 @@
|
|||
#include <config.h>
|
||||
#include <gnustep/base/behavior.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSGDictionary.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSUtilities.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
@ -40,6 +39,9 @@
|
|||
|
||||
@implementation NSDictionary
|
||||
|
||||
@class NSGDictionary;
|
||||
@class NSGMutableDictionary;
|
||||
|
||||
static Class NSDictionary_concrete_class;
|
||||
static Class NSMutableDictionary_concrete_class;
|
||||
|
||||
|
@ -225,6 +227,7 @@ static Class NSMutableDictionary_concrete_class;
|
|||
OBJC_MALLOC (keys, id, capacity);
|
||||
if (firstObject != nil)
|
||||
{
|
||||
NSDictionary *d;
|
||||
objects[num_pairs] = firstObject;
|
||||
/* Keep grabbing arguments until we get a nil... */
|
||||
while ((arg = va_arg (ap, id)))
|
||||
|
@ -246,9 +249,11 @@ static Class NSMutableDictionary_concrete_class;
|
|||
}
|
||||
}
|
||||
NSAssert (argi % 2 == 0, NSInvalidArgumentException);
|
||||
return [[[self alloc] initWithObjects: objects forKeys: keys
|
||||
count: num_pairs]
|
||||
autorelease];
|
||||
d = [[[self alloc] initWithObjects: objects forKeys: keys
|
||||
count: num_pairs] autorelease];
|
||||
OBJC_FREE(objects);
|
||||
OBJC_FREE(keys);
|
||||
return d;
|
||||
}
|
||||
/* FIRSTOBJECT was nil; just return an empty NSDictionary object. */
|
||||
return [self dictionary];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue