diff --git a/src/common.h b/src/common.h index b6c90c0..e93616e 100644 --- a/src/common.h +++ b/src/common.h @@ -27,6 +27,7 @@ namespace { result, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, + 1, NULL); snprintf(msg, ERR_MSG_MAX_LEN, @@ -34,6 +35,8 @@ namespace { method, lpMsgBuf, result); + + LocalFree(lpMsgBuf); #else snprintf(msg, ERR_MSG_MAX_LEN, diff --git a/src/pcsclite.cpp b/src/pcsclite.cpp index e6abf87..3a19d1b 100644 --- a/src/pcsclite.cpp +++ b/src/pcsclite.cpp @@ -43,7 +43,7 @@ PCSCLite::PCSCLite(): m_card_context(0), 1); if ((result != SCARD_S_SUCCESS) && (result != SCARD_E_TIMEOUT)) { - NanThrowError(pcsc_stringify_error(result)); + NanThrowError(error_msg("SCardGetStatusChange", result).c_str()); } else { m_pnp = !(m_card_reader_state.dwEventState & SCARD_STATE_UNKNOWN); }