From: Karsten O. <wid...@t-...> - 2016-10-28 00:21:57
|
Hi, thanks for the patch. I have a applied it in a slightly modified version. Check out the latest version from the trunk. Best Regards, Karsten Am 28.10.2016 um 00:52 schrieb Antonio Antonio: > Hi, > there is a memory leak in > https://sourceforge.net/p/globalplatform/code/HEAD/tree/trunk/gppcscconnectionplugin/src/gppcscconnectionplugin.c#l221 > > description: allocating cardInfo->librarySpecific without handling the > error case. > issue: if SCardConnect fails just go to end leaving > cardInfo->librarySpecific allocated > fix: suggest to add the green lines > regards > Antonio > cardInfo->librarySpecific = malloc(sizeof(PCSC_CARD_INFO_SPECIFIC)); > if (cardInfo->librarySpecific == NULL) { > OPGP_ERROR_CREATE_ERROR(status, ENOMEM, OPGP_stringify_error(ENOMEM)); > goto end; > } > pcscCardInfo = GET_PCSC_CARD_INFO_SPECIFIC_P(cardInfo); > result = SCardConnect( GET_SCARDCONTEXT(cardContext), > readerName, > SCARD_SHARE_SHARED, > protocol, > &(pcscCardInfo->cardHandle), > &activeProtocol ); > if(SCARD_S_SUCCESS!=result){ > /************** memory leak fix *****************/ > */if (cardInfo->librarySpecific != NULL) { > free(cardInfo->librarySpecific); cardInfo->librarySpecific = NULL; }/* > /************** memory leak fix - end ************/*//* > goto end; > } > > > ------------------------------------------------------------------------------ > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > > > _______________________________________________ > Globalplatform-developers mailing list > Glo...@li... > https://lists.sourceforge.net/lists/listinfo/globalplatform-developers |