From: Armin Novak Date: Sun, 16 Nov 2014 21:50:50 +0000 (+0100) Subject: Fixed memory leaks. X-Git-Tag: 2.0.0-beta1+android10~765^2~55 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55e455f1abd4681bd39e945e8a2c005b324b108b;p=platform%2Fupstream%2Ffreerdp.git Fixed memory leaks. --- diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c index 0d069a5..cc694be 100644 --- a/winpr/libwinpr/smartcard/smartcard_pcsc.c +++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c @@ -1418,7 +1418,10 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChange_Internal(SCARDCONTEXT hContext states = (PCSC_SCARD_READERSTATE*) calloc(pcsc_cReaders, sizeof(PCSC_SCARD_READERSTATE)); if (!states) + { + free (map); return SCARD_E_NO_MEMORY; + } for (i = j = 0; i < pcsc_cReaders; i++) { @@ -1498,13 +1501,13 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChange_Internal(SCARDCONTEXT hContext rgReaderStates[i].dwEventState = SCARD_STATE_IGNORE; } + free(map); + free(states); if ((status == SCARD_S_SUCCESS) && !stateChanged) status = SCARD_E_TIMEOUT; else if ((status == SCARD_E_TIMEOUT) && stateChanged) return SCARD_S_SUCCESS; - free(states); - free(map); return status; } @@ -2044,7 +2047,11 @@ WINSCARDAPI LONG WINAPI PCSC_SCardTransmit(SCARDHANDLE hCard, pcsc_pioRecvPci = (PCSC_SCARD_IO_REQUEST*) malloc(sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes); if (!pcsc_pioRecvPci) + { + if (pioSendPci) + free (pcsc_pioSendPci); return SCARD_E_NO_MEMORY; + } pcsc_pioRecvPci->dwProtocol = (PCSC_DWORD) pioRecvPci->dwProtocol; pcsc_pioRecvPci->cbPciLength = sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes;