Update pcsc.c
SCardFreeMemory function not supported in macOS, if the system is macOS, change to free API to release the resource.
This commit is contained in:
parent
f68cf6960a
commit
1070eb71b6
@ -760,10 +760,33 @@ pcsc_get_information_about(nfc_device *pnd, char **pbuf)
|
|||||||
? "\nserial: " : "", serial_len > 0 ? (char *)serial : "");
|
? "\nserial: " : "", serial_len > 0 ? (char *)serial : "");
|
||||||
|
|
||||||
error:
|
error:
|
||||||
SCardFreeMemory(*pscc, name);
|
// SCardFreeMemory function not supported in macOS.
|
||||||
SCardFreeMemory(*pscc, type);
|
#if defined(__APPLE__)
|
||||||
SCardFreeMemory(*pscc, version);
|
if (name != NULL){
|
||||||
SCardFreeMemory(*pscc, serial);
|
free(name);
|
||||||
|
name = NULL;
|
||||||
|
}
|
||||||
|
if (type != NULL){
|
||||||
|
free(type);
|
||||||
|
type = NULL;
|
||||||
|
}
|
||||||
|
if (version != NULL){
|
||||||
|
free(version);
|
||||||
|
version = NULL;
|
||||||
|
}
|
||||||
|
if (serial != NULL){
|
||||||
|
free(serial);
|
||||||
|
serial = NULL;
|
||||||
|
}
|
||||||
|
if (pscc != NULL){
|
||||||
|
SCardReleaseContext(pscc);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
SCardFreeMemory(*pscc, name); SCardFreeMemory(*pscc, name);
|
||||||
|
SCardFreeMemory(*pscc, type); SCardFreeMemory(*pscc, type);
|
||||||
|
SCardFreeMemory(*pscc, version); SCardFreeMemory(*pscc, version);
|
||||||
|
SCardFreeMemory(*pscc, serial); SCardFreeMemory(*pscc, serial);
|
||||||
|
#endif
|
||||||
|
|
||||||
pnd->last_error = res;
|
pnd->last_error = res;
|
||||||
return pnd->last_error;
|
return pnd->last_error;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user