OpenPGP: free memory when selecting the application fails

free() the memory already reserved when the file identifying the OpenPGP
application fails & reset the pointers in the card strcuture back to NULL.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5481 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2011-05-23 17:31:55 +00:00
parent 56f6718bf2
commit 6e04d7f6bf
1 changed files with 5 additions and 1 deletions

View File

@ -178,8 +178,12 @@ pgp_init(sc_card_t *card)
/* select application "OpenPGP" */
sc_format_path("D276:0001:2401", &aid);
aid.type = SC_PATH_TYPE_DF_NAME;
if ((r = iso_ops->select_file(card, &aid, &file)) < 0)
if ((r = iso_ops->select_file(card, &aid, &file)) < 0) {
free(priv->mf);
free(priv);
card->drv_data = NULL;
return r;
}
sc_format_path("3f00", &file->path);
file->type = SC_FILE_TYPE_DF;