]> git.sur5r.net Git - openldap/commitdiff
Plug leak
authorHoward Chu <hyc@openldap.org>
Tue, 4 Apr 2006 10:12:55 +0000 (10:12 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 4 Apr 2006 10:12:55 +0000 (10:12 +0000)
servers/slapd/back-shell/fork.c

index 5f46a2a75a10cead373f68b67a301c3a014d89ef..500637e035e8b094d47e3fae0982b7a46fc7a142 100644 (file)
@@ -103,7 +103,12 @@ forkandexec(
        if ( (*rfp = fdopen( c2p[0], "r" )) == NULL || (*wfp = fdopen( p2c[1],
            "w" )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "fdopen failed\n", 0, 0, 0 );
-               close( c2p[0] );
+               if ( *rfp ) {
+                       fclose( *rfp );
+                       *rfp = NULL;
+               } else {
+                       close( c2p[0] );
+               }
                close( p2c[1] );
 
                return( -1 );