From 8a87a4ee9107f250254d5c93c6fd62224c400ce7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?=
 <ng.hong.quan@gmail.com>
Date: Mon, 14 Jul 2014 01:30:28 +0800
Subject: [PATCH 24/26] OpenPGP: Fix crash after accessing inexistent file.

---
 src/libopensc/card-openpgp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
index ca3173c..94c69ae 100644
--- a/src/libopensc/card-openpgp.c
+++ b/src/libopensc/card-openpgp.c
@@ -973,7 +973,6 @@ pgp_select_file(sc_card_t *card, const sc_path_t *path, sc_file_t **ret)
 			 * So we set its size to be the same as max certificate size the card supports. */
 			(*ret)->size = priv->max_cert_size;
 		}
-		priv->current = NULL;
 		LOG_FUNC_RETURN(card->ctx, SC_SUCCESS);
 	}
 
@@ -990,7 +989,6 @@ pgp_select_file(sc_card_t *card, const sc_path_t *path, sc_file_t **ret)
 		/* This file ID is refered when importing key&certificate via pkcs15init, like above.
 		 * We pretend to successfully find this inexistent file. */
 		if (id == 0x4402 || id == 0x5f48) {
-			priv->current = NULL;
 			if (ret == NULL)
 				/* No need to return file */
 				LOG_FUNC_RETURN(card->ctx, SC_SUCCESS);
@@ -1002,7 +1000,6 @@ pgp_select_file(sc_card_t *card, const sc_path_t *path, sc_file_t **ret)
 		}
 
 		if (r < 0) {	/* failure */
-			priv->current = NULL;
 			LOG_FUNC_RETURN(card->ctx, r);
 		}
 	}
-- 
2.1.3

