mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
missing free
This commit is contained in:
parent
8228b66cb6
commit
9ce820768c
1 changed files with 2 additions and 4 deletions
|
@ -415,8 +415,10 @@ int loadFile_safe(const char *preferredName, const char *suffix, void **pdata, s
|
||||||
FILE *f = fopen(path, "rb");
|
FILE *f = fopen(path, "rb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
PrintAndLogEx(WARNING, "file not found or locked. '" _YELLOW_("%s")"'", path);
|
PrintAndLogEx(WARNING, "file not found or locked. '" _YELLOW_("%s")"'", path);
|
||||||
|
free(path);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
|
|
||||||
// get filesize in order to malloc memory
|
// get filesize in order to malloc memory
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
|
@ -425,7 +427,6 @@ int loadFile_safe(const char *preferredName, const char *suffix, void **pdata, s
|
||||||
|
|
||||||
if (fsize <= 0) {
|
if (fsize <= 0) {
|
||||||
PrintAndLogEx(FAILED, "error, when getting filesize");
|
PrintAndLogEx(FAILED, "error, when getting filesize");
|
||||||
free(path);
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
@ -433,7 +434,6 @@ int loadFile_safe(const char *preferredName, const char *suffix, void **pdata, s
|
||||||
*pdata = calloc(fsize, sizeof(uint8_t));
|
*pdata = calloc(fsize, sizeof(uint8_t));
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
PrintAndLogEx(FAILED, "error, cannot allocate memory");
|
PrintAndLogEx(FAILED, "error, cannot allocate memory");
|
||||||
free(path);
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
@ -444,14 +444,12 @@ int loadFile_safe(const char *preferredName, const char *suffix, void **pdata, s
|
||||||
|
|
||||||
if (bytes_read != fsize) {
|
if (bytes_read != fsize) {
|
||||||
PrintAndLogEx(FAILED, "error, bytes read mismatch file size");
|
PrintAndLogEx(FAILED, "error, bytes read mismatch file size");
|
||||||
free(path);
|
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*datalen = bytes_read;
|
*datalen = bytes_read;
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "loaded %d bytes from binary file " _YELLOW_("%s"), bytes_read, preferredName);
|
PrintAndLogEx(SUCCESS, "loaded %d bytes from binary file " _YELLOW_("%s"), bytes_read, preferredName);
|
||||||
free(path);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue