Fix memory leaks found by valgrind.
This commit is contained in:
parent
72642b40b3
commit
d1ec010660
6 changed files with 20 additions and 12 deletions
|
|
@ -65,10 +65,8 @@ bool cipher_open_blowfish_ofb(cipher_t *cipher) {
|
|||
|
||||
void cipher_close(cipher_t *cipher) {
|
||||
EVP_CIPHER_CTX_cleanup(&cipher->ctx);
|
||||
if(cipher->counter) {
|
||||
free(cipher->counter);
|
||||
cipher->counter = 0;
|
||||
}
|
||||
free(cipher->counter);
|
||||
cipher->counter = NULL;
|
||||
}
|
||||
|
||||
size_t cipher_keylength(const cipher_t *cipher) {
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ bool digest_set_key(digest_t *digest, const void *key, size_t len) {
|
|||
}
|
||||
|
||||
void digest_close(digest_t *digest) {
|
||||
if(digest->key)
|
||||
free(digest->key);
|
||||
free(digest->key);
|
||||
digest->key = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue