Avoid potential memory leak

This commit is contained in:
Jakub Jelen 2017-11-06 12:38:07 +01:00 committed by Frank Morgner
parent 07267df313
commit 77f2640ea7
1 changed files with 2 additions and 0 deletions

View File

@ -776,6 +776,8 @@ static int sc_pkcs15emu_piv_init(sc_pkcs15_card_t *p15card)
if (r == SC_SUCCESS) {
token_name = malloc (cn_len+1);
if (!token_name) {
sc_pkcs15_free_certificate(cert_out);
free(cn_name);
SC_FUNC_RETURN(card->ctx,
SC_ERROR_OUT_OF_MEMORY, r);
}