fixed memory leak during decrypt, reported in #10

This commit is contained in:
git@daemon.de
2015-10-12 12:17:51 +02:00
parent 61d3cbae83
commit 3a8d8c010f
3 changed files with 32 additions and 22 deletions

View File

@@ -192,7 +192,7 @@ pcp_key_t *pcpkey_encrypt(PCPCTX *ptx, pcp_key_t *key, char *passphrase) {
pcp_key_t *pcpkey_decrypt(PCPCTX *ptx, pcp_key_t *key, char *passphrase) {
byte *encryptkey = pcp_derivekey(ptx, passphrase, key->nonce);
byte *decrypted;
byte *decrypted = ucmalloc(LSEC - crypto_secretbox_MACBYTES);
size_t es;
es = pcp_sodium_verify_mac(&decrypted, key->encrypted, LSEC, key->nonce, encryptkey);