mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
fix: mem leaks.
This commit is contained in:
parent
91d6836a47
commit
de317d9f48
1 changed files with 7 additions and 2 deletions
|
@ -1723,7 +1723,7 @@ int CmdHF14AMfChk(const char *Cmd) {
|
||||||
if (strlen(Cmd) < 3 || ctmp == 'h') return usage_hf14_chk();
|
if (strlen(Cmd) < 3 || ctmp == 'h') return usage_hf14_chk();
|
||||||
|
|
||||||
FILE * f;
|
FILE * f;
|
||||||
char filename[FILE_PATH_SIZE]={0};
|
char filename[FILE_PATH_SIZE] = {0};
|
||||||
char buf[13];
|
char buf[13];
|
||||||
uint8_t *keyBlock = NULL, *p;
|
uint8_t *keyBlock = NULL, *p;
|
||||||
sector_t *e_sector = NULL;
|
sector_t *e_sector = NULL;
|
||||||
|
@ -1970,8 +1970,10 @@ out:
|
||||||
|
|
||||||
if (createDumpFile) {
|
if (createDumpFile) {
|
||||||
fptr = GenerateFilename("hf-mf-", "-key.bin");
|
fptr = GenerateFilename("hf-mf-", "-key.bin");
|
||||||
if (fptr == NULL)
|
if (fptr == NULL) {
|
||||||
|
free(keyBlock);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
FILE *fkeys = fopen(fptr, "wb");
|
FILE *fkeys = fopen(fptr, "wb");
|
||||||
if (fkeys == NULL) {
|
if (fkeys == NULL) {
|
||||||
|
@ -2489,15 +2491,18 @@ int CmdHF14AMfELoad(const char *Cmd) {
|
||||||
if ( blockWidth == 4 ) {
|
if ( blockWidth == 4 ) {
|
||||||
if ((blockNum != numBlocks)) {
|
if ((blockNum != numBlocks)) {
|
||||||
PrintAndLogEx(FAILED, "Warning, Ultralight/Ntag file content, Loaded %d blocks into emulator memory", blockNum);
|
PrintAndLogEx(FAILED, "Warning, Ultralight/Ntag file content, Loaded %d blocks into emulator memory", blockNum);
|
||||||
|
free(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((blockNum != numBlocks)) {
|
if ((blockNum != numBlocks)) {
|
||||||
PrintAndLogEx(FAILED, "Error, file content, Only loaded %d blocks, must be %d blocks into emulator memory", blockNum, numBlocks);
|
PrintAndLogEx(FAILED, "Error, file content, Only loaded %d blocks, must be %d blocks into emulator memory", blockNum, numBlocks);
|
||||||
|
free(data);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PrintAndLogEx(SUCCESS, "Loaded %d blocks from file: " _YELLOW_(%s), blockNum, filename);
|
PrintAndLogEx(SUCCESS, "Loaded %d blocks from file: " _YELLOW_(%s), blockNum, filename);
|
||||||
|
free(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue