diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index b48fd3d0a..3f704ad62 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -577,9 +577,6 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n size_t alen = 0, blen = 0; uint8_t *keyA, *keyB; if (loadFileBinaryKey(keyfn, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) { - if (keyA) { - free(keyA); - } free(fptr); return PM3_ESOFT; } @@ -1339,9 +1336,6 @@ static int CmdHF14AMfRestore(const char *Cmd) { size_t alen = 0, blen = 0; uint8_t *keyA, *keyB; if (loadFileBinaryKey(keyfilename, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) { - if (keyA) { - free(keyA); - } return PM3_ESOFT; } @@ -6289,9 +6283,6 @@ int CmdHFMFNDEFFormat(const char *Cmd) { size_t alen = 0, blen = 0; uint8_t *tmpA, *tmpB; if (loadFileBinaryKey(keyFilename, "", (void **)&tmpA, (void **)&tmpB, &alen, &blen) != PM3_SUCCESS) { - if (tmpA) { - free(tmpA); - } goto skipfile; } diff --git a/client/src/fileutils.c b/client/src/fileutils.c index f266da9b2..7ca59ef85 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -1609,6 +1609,7 @@ int loadFileBinaryKey(const char *preferredName, const char *suffix, void **keya if (*keyb == NULL) { PrintAndLogEx(FAILED, "error, cannot allocate memory"); fclose(f); + free(*keya); return PM3_EMALLOC; }