From 145ee3baa74635b58df8eecdf70a0fdb10e8b879 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 27 Mar 2025 21:47:42 +0100 Subject: [PATCH] fix double-free --- client/src/cmdhfmfu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index b98d6faa1..7419eb493 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -1613,6 +1613,7 @@ static int mfu_dump_tag(uint16_t pages, void **pdata, uint16_t *len) { if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { PrintAndLogEx(WARNING, "command execution time out"); free(*pdata); + *pdata = NULL; res = PM3_ETIMEOUT; goto out; } @@ -1620,6 +1621,7 @@ static int mfu_dump_tag(uint16_t pages, void **pdata, uint16_t *len) { if (resp.oldarg[0] != 1) { PrintAndLogEx(WARNING, "Failed reading card"); free(*pdata); + *pdata = NULL; res = PM3_ESOFT; 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) { PrintAndLogEx(WARNING, "command execution time out"); free(*pdata); + *pdata = NULL; res = PM3_ETIMEOUT; goto out; }