diff options
| author | Nathan Kinder <nkinder@redhat.com> | 2009-11-16 15:49:57 -0800 |
|---|---|---|
| committer | Nathan Kinder <nkinder@redhat.com> | 2009-11-16 15:49:57 -0800 |
| commit | 5c71f20ebfa08b7f8d86eb57d5a73a8a44f5bb8e (patch) | |
| tree | 19d7028c75669a0b66d059ee290ac498866a56df | |
| parent | 6319251696baccdbd8ab42390c0802996f3c701e (diff) | |
| download | ds-5c71f20ebfa08b7f8d86eb57d5a73a8a44f5bb8e.tar.gz ds-5c71f20ebfa08b7f8d86eb57d5a73a8a44f5bb8e.tar.xz ds-5c71f20ebfa08b7f8d86eb57d5a73a8a44f5bb8e.zip | |
Avoid freeing NULL trimmed passwords list
My previous patch for removing the fixed length buffer used in
the password history checking code introduced a problem where we
could attempt to free a NULL pointer.
| -rw-r--r-- | ldap/servers/slapd/pw.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c index 76dce382..cafdfd68 100644 --- a/ldap/servers/slapd/pw.c +++ b/ldap/servers/slapd/pw.c @@ -1120,7 +1120,7 @@ int update_pw_history( Slapi_PBlock *pb, char *dn, char *old_pw ) { static int pw_in_history( Slapi_Value **history_vals, const Slapi_Value *pw_val) { - Slapi_Value **trimmed_history; + Slapi_Value **trimmed_history = NULL; int num_history_vals = 0; int i; int ret = -1; @@ -1183,16 +1183,16 @@ int pw_in_history( Slapi_Value **history_vals, const Slapi_Value *pw_val) /* Check if the new password is in the trimmed history list. */ ret = slapi_pw_find_sv(trimmed_history, pw_val); - } - /* Free the trimmed values. */ - for ( i = 0; trimmed_history[i] != NULL; i++ ) - { - slapi_ch_free((void **)&trimmed_history[i]); - } + /* Free the trimmed values. */ + for ( i = 0; trimmed_history[i] != NULL; i++ ) + { + slapi_ch_free((void **)&trimmed_history[i]); + } - /* Free the array. */ - slapi_ch_free((void **)&trimmed_history); + /* Free the array. */ + slapi_ch_free((void **)&trimmed_history); + } return ( ret ); } |
