OpenPGP: re-factor pgp_finish()
Re-structure pgp_finish() for easier reading. While at it, check for priv != NULL before free()ing it. Signed-off-by: Peter Marschall <peter@adpm.de> git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5486 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
ec1f1bd812
commit
9aa7342000
|
@ -243,17 +243,18 @@ pgp_init(sc_card_t *card)
|
|||
static int
|
||||
pgp_finish(sc_card_t *card)
|
||||
{
|
||||
struct pgp_priv_data *priv;
|
||||
|
||||
if (card == NULL)
|
||||
return SC_SUCCESS;
|
||||
priv = DRVDATA (card);
|
||||
if (card != NULL) {
|
||||
struct pgp_priv_data *priv = DRVDATA (card);
|
||||
|
||||
if (priv != NULL) {
|
||||
/* delete fake file hierarchy */
|
||||
pgp_iterate_blobs(priv->mf, 99, pgp_free_blob);
|
||||
|
||||
/* delete private data */
|
||||
free(priv);
|
||||
}
|
||||
card->drv_data = NULL;
|
||||
}
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue