From 76916d614b313fad93a3f5c78fdf94e5ad58e9a4 Mon Sep 17 00:00:00 2001 From: Kirill Kotyagin Date: Wed, 22 Jul 2015 16:56:24 +0300 Subject: [PATCH 1/2] channels/smartcard: make smartcard_ListReaders(A/W)_Call return PCSC error statuses to the server --- channels/smartcard/client/smartcard_operations.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index d595bf58f..2403ce9af 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -320,9 +320,6 @@ static UINT32 smartcard_ListReadersA_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD call->mszGroups = NULL; } - if (status != SCARD_S_SUCCESS) - return status; - smartcard_trace_list_readers_return(smartcard, &ret, FALSE); status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret); @@ -373,9 +370,6 @@ static UINT32 smartcard_ListReadersW_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD call->mszGroups = NULL; } - if (status != SCARD_S_SUCCESS) - return status; - smartcard_trace_list_readers_return(smartcard, &ret, TRUE); status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret); From ef37487a4426e95453e6ca93e9de6fda52c0fc80 Mon Sep 17 00:00:00 2001 From: Kirill Kotyagin Date: Wed, 22 Jul 2015 17:25:17 +0300 Subject: [PATCH 2/2] channels/smartcard: fix possible mszReaders leak in smartcard_ListReaders(A/W)_Call --- channels/smartcard/client/smartcard_operations.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index 2403ce9af..867a339fb 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -323,12 +323,12 @@ static UINT32 smartcard_ListReadersA_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD smartcard_trace_list_readers_return(smartcard, &ret, FALSE); status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret); - if (status != SCARD_S_SUCCESS) - return status; - if (mszReaders) SCardFreeMemory(operation->hContext, mszReaders); + if (status != SCARD_S_SUCCESS) + return status; + return ret.ReturnCode; } @@ -371,15 +371,14 @@ static UINT32 smartcard_ListReadersW_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD } smartcard_trace_list_readers_return(smartcard, &ret, TRUE); - status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret); - if (status != SCARD_S_SUCCESS) - return status; - if (mszReaders) SCardFreeMemory(operation->hContext, mszReaders); + if (status != SCARD_S_SUCCESS) + return status; + return ret.ReturnCode; }