]> git.sur5r.net Git - openldap/commitdiff
ITS#6929 fclose(password file) on failure.
authorHallvard Furuseth <hallvard@openldap.org>
Thu, 21 Apr 2011 15:50:50 +0000 (17:50 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Thu, 5 May 2011 11:40:15 +0000 (13:40 +0200)
lutil_get_filed_password() bug; klocwork issue#203.

libraries/liblutil/passfile.c

index 11d16c7841a3921cb971cba3f87ae7aba187226b..52225146e2873c93151615a92ec8735001495a1c 100644 (file)
@@ -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;
                }