From: Hallvard Furuseth Date: Thu, 21 Apr 2011 15:50:50 +0000 (+0200) Subject: ITS#6929 fclose(password file) on failure. X-Git-Tag: OPENLDAP_REL_ENG_2_4_26~135 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=516fb71066158a5dc6f4a76d0b862b659d2911cb;p=openldap ITS#6929 fclose(password file) on failure. lutil_get_filed_password() bug; klocwork issue#203. --- diff --git a/libraries/liblutil/passfile.c b/libraries/liblutil/passfile.c index 11d16c7841..52225146e2 100644 --- a/libraries/liblutil/passfile.c +++ b/libraries/liblutil/passfile.c @@ -65,6 +65,7 @@ lutil_get_filed_password( passwd->bv_val = (char *) ber_memalloc( passwd->bv_len + 1 ); if( passwd->bv_val == NULL ) { perror( filename ); + fclose( f ); return -1; } @@ -79,6 +80,7 @@ lutil_get_filed_password( ber_memfree( passwd->bv_val ); passwd->bv_val = NULL; passwd->bv_len = 0; + fclose( f ); return -1; } nleft = passwd->bv_len; @@ -92,6 +94,7 @@ lutil_get_filed_password( ber_memfree( passwd->bv_val ); passwd->bv_val = NULL; passwd->bv_len = 0; + fclose( f ); return -1; }