Use an autorelease pool in member expansion

Otherwise, we would hold one ldap connection for each member of a group.
And close them all later. With large groups, we could hit the open file limit
(or the open file limit of the ldap server).

Fixes #2256
pull/10/head
Jean Raby 2013-03-01 16:24:16 -05:00
parent a7c3f33447
commit f1846191d5
1 changed files with 7 additions and 1 deletions

View File

@ -57,6 +57,7 @@
#include "SOGoGroup.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
@ -224,6 +225,7 @@
NSDictionary *d;
SOGoUser *user;
NSArray *o;
NSAutoreleasePool *pool;
int i, c;
if (!_members)
@ -259,7 +261,8 @@
// We add members for whom we have their associated DN
for (i = 0; i < [dns count]; i++)
{
{
pool = [NSAutoreleasePool new];
dn = [dns objectAtIndex: i];
login = [um getLoginForDN: [dn lowercaseString]];
user = [SOGoUser userWithLogin: login roles: nil];
@ -268,11 +271,13 @@
[logins addObject: login];
[_members addObject: user];
}
[pool release];
}
// We add members for whom we have their associated login name
for (i = 0; i < [uids count]; i++)
{
pool = [NSAutoreleasePool new];
login = [uids objectAtIndex: i];
user = [SOGoUser userWithLogin: login roles: nil];
@ -281,6 +286,7 @@
[logins addObject: login];
[_members addObject: user];
}
[pool release];
}