fix double-free

This commit is contained in:
Philippe Teuwen 2025-03-27 21:47:42 +01:00
commit 145ee3baa7

View file

@ -1613,6 +1613,7 @@ static int mfu_dump_tag(uint16_t pages, void **pdata, uint16_t *len) {
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
PrintAndLogEx(WARNING, "command execution time out"); PrintAndLogEx(WARNING, "command execution time out");
free(*pdata); free(*pdata);
*pdata = NULL;
res = PM3_ETIMEOUT; res = PM3_ETIMEOUT;
goto out; goto out;
} }
@ -1620,6 +1621,7 @@ static int mfu_dump_tag(uint16_t pages, void **pdata, uint16_t *len) {
if (resp.oldarg[0] != 1) { if (resp.oldarg[0] != 1) {
PrintAndLogEx(WARNING, "Failed reading card"); PrintAndLogEx(WARNING, "Failed reading card");
free(*pdata); free(*pdata);
*pdata = NULL;
res = PM3_ESOFT; res = PM3_ESOFT;
goto out; goto out;
} }
@ -1635,6 +1637,7 @@ static int mfu_dump_tag(uint16_t pages, void **pdata, uint16_t *len) {
if (GetFromDevice(BIG_BUF, *pdata, buffer_size, startindex, NULL, 0, NULL, 2500, false) == false) { if (GetFromDevice(BIG_BUF, *pdata, buffer_size, startindex, NULL, 0, NULL, 2500, false) == false) {
PrintAndLogEx(WARNING, "command execution time out"); PrintAndLogEx(WARNING, "command execution time out");
free(*pdata); free(*pdata);
*pdata = NULL;
res = PM3_ETIMEOUT; res = PM3_ETIMEOUT;
goto out; goto out;
} }