From fa10dfa186c0c4edb5b573f5d72946e59de02d75 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 18 Feb 2020 12:50:29 +0100 Subject: [PATCH] Fixed memory leaks in PCSC_SCardReadCache[AW] --- winpr/libwinpr/smartcard/smartcard_pcsc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c index 030df9869..c4fd80eb8 100644 --- a/winpr/libwinpr/smartcard/smartcard_pcsc.c +++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c @@ -2541,7 +2541,10 @@ static LONG WINAPI PCSC_SCardReadCacheA(SCARDCONTEXT hContext, UUID* CardIdentif return SCARD_E_NO_MEMORY; if (!PCSC_AddMemoryBlock(hContext, mem)) + { + free(mem); return SCARD_E_NO_MEMORY; + } memcpy(mem, data->data, data->len); *ppData = mem; @@ -2579,7 +2582,10 @@ static LONG WINAPI PCSC_SCardReadCacheW(SCARDCONTEXT hContext, UUID* CardIdentif return SCARD_E_NO_MEMORY; if (!PCSC_AddMemoryBlock(hContext, mem)) + { + free(mem); return SCARD_E_NO_MEMORY; + } memcpy(mem, data->data, data->len); *ppData = mem;