[scard] fixed memory leak
card_id_and_name_* return allocated values, free after use
This commit is contained in:
parent
58bc1ee4c9
commit
e1eacad74c
@ -140,15 +140,13 @@ static DWORD WINAPI smartcard_context_thread(LPVOID arg)
|
||||
error = smartcard_complete_irp(smartcard, element->irp, &handled);
|
||||
if (!handled)
|
||||
element->irp->Discard(element->irp);
|
||||
smartcard_operation_free(&element->operation, TRUE);
|
||||
|
||||
if (error)
|
||||
{
|
||||
smartcard_operation_free(&element->operation, TRUE);
|
||||
WLog_ERR(TAG, "Queue_Enqueue failed!");
|
||||
break;
|
||||
}
|
||||
|
||||
smartcard_operation_free(&element->operation, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2873,7 +2873,10 @@ static LONG WINAPI PCSC_SCardWriteCacheA(SCARDCONTEXT hContext, UUID* CardIdenti
|
||||
memcpy(data->data, Data, data->len);
|
||||
|
||||
HashTable_Remove(ctx->cache, id);
|
||||
if (!HashTable_Insert(ctx->cache, id, data))
|
||||
const BOOL rc = HashTable_Insert(ctx->cache, id, data);
|
||||
free(id);
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
pcsc_cache_item_free(data);
|
||||
return SCARD_E_NO_MEMORY;
|
||||
@ -2915,11 +2918,15 @@ static LONG WINAPI PCSC_SCardWriteCacheW(SCARDCONTEXT hContext, UUID* CardIdenti
|
||||
memcpy(data->data, Data, data->len);
|
||||
|
||||
HashTable_Remove(ctx->cache, id);
|
||||
if (!HashTable_Insert(ctx->cache, id, data))
|
||||
const BOOL rc = HashTable_Insert(ctx->cache, id, data);
|
||||
free(id);
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
pcsc_cache_item_free(data);
|
||||
return SCARD_E_NO_MEMORY;
|
||||
}
|
||||
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user