Skip to content

Commit

Permalink
src: fix readers_name memory deletion
Browse files Browse the repository at this point in the history
- 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: #45.
  • Loading branch information
santigimeno committed Jan 22, 2016
1 parent e424a8f commit 455afb1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pcsclite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 455afb1

Please sign in to comment.