From f1846191d5d47717e7c5dff710e265e21c8f0fe2 Mon Sep 17 00:00:00 2001 From: Jean Raby Date: Fri, 1 Mar 2013 16:24:16 -0500 Subject: [PATCH] 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 --- SoObjects/SOGo/SOGoGroup.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SoObjects/SOGo/SOGoGroup.m b/SoObjects/SOGo/SOGoGroup.m index 3712a952a..4a170be9b 100644 --- a/SoObjects/SOGo/SOGoGroup.m +++ b/SoObjects/SOGo/SOGoGroup.m @@ -57,6 +57,7 @@ #include "SOGoGroup.h" #import +#import #import #import @@ -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]; }