fix possible descriptor leak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30100 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-04-07 14:56:51 +00:00
parent 250b37be9b
commit 25ff8b3385
2 changed files with 9 additions and 1 deletions

View file

@ -1077,7 +1077,14 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (id) initWithFileDescriptor: (int)desc closeOnDealloc: (BOOL)flag
{
self = [super init];
if (self != nil)
if (nil == self)
{
if (YES == flag)
{
close(desc);
}
}
else
{
struct stat sbuf;
int e;