s3:pdb_set_pw_history: free the old history before setting the new.
[amitay/samba.git] / source3 / passdb / pdb_get_set.c
index 30775e49fe541684f8cbc35db32b3d651a2becc6..da65440b06339c4d5685f84e2b09438b482a752d 100644 (file)
@@ -876,6 +876,7 @@ bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], e
 bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32 historyLen, enum pdb_value_state flag)
 {
        if (historyLen && pwd){
+               data_blob_free(&(sampass->nt_pw_his));
                sampass->nt_pw_his = data_blob_talloc(sampass,
                                                pwd, historyLen*PW_HISTORY_ENTRY_LEN);
                if (!sampass->nt_pw_his.length) {