mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#6929 fclose(password file) on failure.
lutil_get_filed_password() bug; klocwork issue#203.
This commit is contained in:
parent
28ab7ad253
commit
375bc1ace7
@ -65,6 +65,7 @@ lutil_get_filed_password(
|
|||||||
passwd->bv_val = (char *) ber_memalloc( passwd->bv_len + 1 );
|
passwd->bv_val = (char *) ber_memalloc( passwd->bv_len + 1 );
|
||||||
if( passwd->bv_val == NULL ) {
|
if( passwd->bv_val == NULL ) {
|
||||||
perror( filename );
|
perror( filename );
|
||||||
|
fclose( f );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ lutil_get_filed_password(
|
|||||||
ber_memfree( passwd->bv_val );
|
ber_memfree( passwd->bv_val );
|
||||||
passwd->bv_val = NULL;
|
passwd->bv_val = NULL;
|
||||||
passwd->bv_len = 0;
|
passwd->bv_len = 0;
|
||||||
|
fclose( f );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
nleft = passwd->bv_len;
|
nleft = passwd->bv_len;
|
||||||
@ -92,6 +94,7 @@ lutil_get_filed_password(
|
|||||||
ber_memfree( passwd->bv_val );
|
ber_memfree( passwd->bv_val );
|
||||||
passwd->bv_val = NULL;
|
passwd->bv_val = NULL;
|
||||||
passwd->bv_len = 0;
|
passwd->bv_len = 0;
|
||||||
|
fclose( f );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user