From c84c84169f7a73eab27f6a9b13b77432baa5c3f8 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: Wed, 8 May 2013 16:51:21 +0700
Subject: [PATCH 18/26] Move declaration to top of block.

---
 src/libopensc/card-openpgp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: opensc-20150513/src/libopensc/card-openpgp.c
===================================================================
--- opensc-20150513.orig/src/libopensc/card-openpgp.c
+++ opensc-20150513/src/libopensc/card-openpgp.c
@@ -746,6 +746,7 @@ pgp_read_blob(sc_card_t *card, struct bl
 		u8 	buffer[2048];
 		size_t	buf_len = (card->caps & SC_CARD_CAP_APDU_EXT)
 				  ? sizeof(buffer) : 256;
+		int r = SC_SUCCESS;
 
 		/* Buffer length for certificate */
 		if (blob->id == DO_CERT && priv->max_cert_size > 0) {
@@ -759,7 +760,7 @@ pgp_read_blob(sc_card_t *card, struct bl
 			buf_len = MAXLEN_RESP_PUBKEY_GNUK;
 		}
 
-		int	r = blob->info->get_fn(card, blob->id, buffer, buf_len);
+		r = blob->info->get_fn(card, blob->id, buffer, buf_len);
 
 		if (r < 0) {	/* an error occurred */
 			blob->status = r;
