[pkg-opensc-commit] [opensc] 157/295: mcrd: Clean up drv_data in case of failure during initialization (partly resolves #943)
Eric Dorland
eric at moszumanska.debian.org
Sat Jun 24 21:11:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository opensc.
commit 9fd8a60cfaeb1c88292020d18c03de33cf75e10d
Author: Jakub Jelen <jjelen at redhat.com>
Date: Mon Jan 23 09:13:48 2017 +0100
mcrd: Clean up drv_data in case of failure during initialization (partly resolves #943)
---
src/libopensc/card-mcrd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/libopensc/card-mcrd.c b/src/libopensc/card-mcrd.c
index dd456ce..f245a10 100644
--- a/src/libopensc/card-mcrd.c
+++ b/src/libopensc/card-mcrd.c
@@ -361,8 +361,11 @@ static int mcrd_init(sc_card_t * card)
r = sc_transmit_apdu(card, &apdu);
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "SELECT AID: %02X%02X", apdu.sw1, apdu.sw2);
- if (apdu.sw1 != 0x90 && apdu.sw2 != 0x00)
- SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_CARD_CMD_FAILED);
+ if (apdu.sw1 != 0x90 && apdu.sw2 != 0x00) {
+ free(card->drv_data);
+ card->drv_data = NULL;
+ SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_CARD);
+ }
}
}
} else {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git
More information about the pkg-opensc-commit
mailing list