mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
FIX: crash on Bionic libc if CloseProxmark is called twice. (@micolous)
https://github.com/Proxmark/proxmark3/pull/672
This commit is contained in:
parent
54bea5a067
commit
9d1c3a3538
1 changed files with 10 additions and 2 deletions
|
@ -141,7 +141,6 @@ static int getCommand(UsbCommand* response) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Entry point into our code: called whenever we received a packet over USB
|
// Entry point into our code: called whenever we received a packet over USB
|
||||||
// that we weren't necessarily expecting, for example a debug print.
|
// that we weren't necessarily expecting, for example a debug print.
|
||||||
|
@ -339,8 +338,16 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode)
|
||||||
|
|
||||||
void CloseProxmark(void) {
|
void CloseProxmark(void) {
|
||||||
conn.run = false;
|
conn.run = false;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __BIONIC__
|
||||||
|
if (USB_communication_thread != 0) {
|
||||||
|
pthread_join(USB_communication_thread, NULL);
|
||||||
|
}
|
||||||
|
#else
|
||||||
pthread_join(USB_communication_thread, NULL);
|
pthread_join(USB_communication_thread, NULL);
|
||||||
//pthread_join(FPC_communication_thread, NULL);
|
//pthread_join(FPC_communication_thread, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sp) {
|
if (sp) {
|
||||||
uart_close(sp);
|
uart_close(sp);
|
||||||
|
@ -358,6 +365,7 @@ void CloseProxmark(void) {
|
||||||
// Clean up our state
|
// Clean up our state
|
||||||
sp = NULL;
|
sp = NULL;
|
||||||
serial_port_name = NULL;
|
serial_port_name = NULL;
|
||||||
|
memset(&USB_communication_thread, 0, sizeof(pthread_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue