src: fix readers_name memory deletion

- After implementing SCARD_AUTOALLOCATE functionality for getting card
  readers name, the deletion of the allocated memory in
  `PCSCLite:: HandleReaderStatusChange` was not correctly migrated and
  was causing serious issues in `Windows`.

- See: https://github.com/santigimeno/node-pcsclite/issues/45.
This commit is contained in:
Santiago Gimeno
2016-01-22 10:03:44 +01:00
parent e424a8f644
commit 455afb1134

View File

@@ -159,7 +159,12 @@ void PCSCLite::HandleReaderStatusChange(uv_async_t *handle, int status) {
}
/* reset AsyncResult */
#ifdef SCARD_AUTOALLOCATE
PCSCLite* pcsclite = async_baton->pcsclite;
SCardFreeMemory(pcsclite->m_card_context, ar->readers_name);
#else
delete [] ar->readers_name;
#endif
ar->readers_name = NULL;
ar->readers_name_length = 0;
ar->result = SCARD_S_SUCCESS;