mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
fix: memory leak when reconnecting to device, reuse old struct
This commit is contained in:
parent
0d1f8ca957
commit
2aec706328
1 changed files with 3 additions and 1 deletions
|
@ -592,7 +592,9 @@ bool OpenProxmark(pm3_device **dev, char *port, bool wait_for_port, int timeout,
|
||||||
session.pm3_present = true; // TODO support for multiple devices
|
session.pm3_present = true; // TODO support for multiple devices
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
*dev = malloc(sizeof(pm3_device));
|
if (*dev == NULL) {
|
||||||
|
*dev = calloc(sizeof(pm3_device), sizeof(uint8_t));
|
||||||
|
}
|
||||||
(*dev)->conn = &conn; // TODO conn shouldn't be global
|
(*dev)->conn = &conn; // TODO conn shouldn't be global
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue