summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2019-11-15 16:33:59 +0000
committerJakub Jelen <jjelen@redhat.com>2019-11-18 09:39:48 +0100
commit21a3f9ecb2fa5d859afc066a8837a029f6064606 (patch)
tree2db55eec2f711e832ce30f2d9907ef266c4adbaa /src
parentaf691f98f6209db91348c1e3a553ed58da3ee091 (diff)
vcard_emul_nss: Remove leak in vcard_emul_rsa_op
The private key returned by PK11_FindPrivateKeyFromCert should be freed by SECKEY_DestroyPrivateKey. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/vcard_emul_nss.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vcard_emul_nss.c b/src/vcard_emul_nss.c
index f788964..12f1e6a 100644
--- a/src/vcard_emul_nss.c
+++ b/src/vcard_emul_nss.c
@@ -263,7 +263,8 @@ vcard_emul_rsa_op(VCard *card, VCardKey *key,
*/
signature_len = PK11_SignatureLen(priv_key);
if ((unsigned)buffer_size != signature_len) {
- return VCARD7816_STATUS_ERROR_DATA_INVALID;
+ ret = VCARD7816_STATUS_ERROR_DATA_INVALID;
+ goto cleanup;
}
/* be able to handle larger keys if necessary */
bp = &buf[0];
@@ -380,6 +381,7 @@ cleanup:
if (bp != buf) {
g_free(bp);
}
+ SECKEY_DestroyPrivateKey(priv_key);
return ret;
}