fix fd leak (happens on failure of fork() ).

This commit is contained in:
Florian Westphal 2005-09-02 21:47:30 +00:00
parent e899c75d7e
commit 6444442931
1 changed files with 3 additions and 1 deletions

View File

@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: resolve.c,v 1.17 2005/07/31 20:13:08 alex Exp $"; static char UNUSED id[] = "$Id: resolve.c,v 1.18 2005/09/02 21:47:30 fw Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -118,6 +118,7 @@ Resolve_Addr( struct sockaddr_in *Addr )
out: /* Error! */ out: /* Error! */
close( s->pipe[0] ); close( s->pipe[0] );
close( s->pipe[1] );
free( s ); free( s );
return NULL; return NULL;
} /* Resolve_Addr */ } /* Resolve_Addr */
@ -168,6 +169,7 @@ Resolve_Name( char *Host )
out: /* Error! */ out: /* Error! */
close( s->pipe[0] ); close( s->pipe[0] );
close( s->pipe[1] );
free( s ); free( s );
return NULL; return NULL;
} /* Resolve_Name */ } /* Resolve_Name */