From 5dcaeccb1e9c643ee149a0c97c3c90464206a24d Mon Sep 17 00:00:00 2001 From: aj Date: Wed, 26 Apr 2006 10:04:33 +0000 Subject: [PATCH] fix double free and segfault. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2905 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/card-piv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libopensc/card-piv.c b/src/libopensc/card-piv.c index 4b228409..b6eb4640 100644 --- a/src/libopensc/card-piv.c +++ b/src/libopensc/card-piv.c @@ -1111,9 +1111,6 @@ static int piv_get_challenge(sc_card_t *card, u8 *rnd, size_t len) sc_unlock(card); - if (rbuf) - free(rbuf); - SC_FUNC_RETURN(card->ctx, 1, 0); } @@ -1340,6 +1337,7 @@ static int piv_init(sc_card_t *card) r = piv_find_aid(card, priv->aid_file); if (r < 0) { sc_error(card->ctx, "Failed to initialize %s\n", card->name); + SC_FUNC_RETURN(card->ctx, 1, r); } priv->enumtag = piv_aids[r].enumtag; card->type = piv_aids[r].enumtag;