mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
better memory clean up, thanks @gentilkiwi
This commit is contained in:
parent
fa0db30143
commit
82d80cc250
2 changed files with 1 additions and 9 deletions
|
@ -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;
|
size_t alen = 0, blen = 0;
|
||||||
uint8_t *keyA, *keyB;
|
uint8_t *keyA, *keyB;
|
||||||
if (loadFileBinaryKey(keyfn, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
if (loadFileBinaryKey(keyfn, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
||||||
if (keyA) {
|
|
||||||
free(keyA);
|
|
||||||
}
|
|
||||||
free(fptr);
|
free(fptr);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -1339,9 +1336,6 @@ static int CmdHF14AMfRestore(const char *Cmd) {
|
||||||
size_t alen = 0, blen = 0;
|
size_t alen = 0, blen = 0;
|
||||||
uint8_t *keyA, *keyB;
|
uint8_t *keyA, *keyB;
|
||||||
if (loadFileBinaryKey(keyfilename, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
if (loadFileBinaryKey(keyfilename, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
||||||
if (keyA) {
|
|
||||||
free(keyA);
|
|
||||||
}
|
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6289,9 +6283,6 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
|
||||||
size_t alen = 0, blen = 0;
|
size_t alen = 0, blen = 0;
|
||||||
uint8_t *tmpA, *tmpB;
|
uint8_t *tmpA, *tmpB;
|
||||||
if (loadFileBinaryKey(keyFilename, "", (void **)&tmpA, (void **)&tmpB, &alen, &blen) != PM3_SUCCESS) {
|
if (loadFileBinaryKey(keyFilename, "", (void **)&tmpA, (void **)&tmpB, &alen, &blen) != PM3_SUCCESS) {
|
||||||
if (tmpA) {
|
|
||||||
free(tmpA);
|
|
||||||
}
|
|
||||||
goto skipfile;
|
goto skipfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1609,6 +1609,7 @@ int loadFileBinaryKey(const char *preferredName, const char *suffix, void **keya
|
||||||
if (*keyb == NULL) {
|
if (*keyb == NULL) {
|
||||||
PrintAndLogEx(FAILED, "error, cannot allocate memory");
|
PrintAndLogEx(FAILED, "error, cannot allocate memory");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
free(*keya);
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue