fix: mem leaks.

This commit is contained in:
iceman1001 2019-02-21 16:17:49 +01:00
commit 6d63b3fbed
9 changed files with 28 additions and 12 deletions

View file

@ -266,8 +266,8 @@ int loadFile(const char *preferredName, const char *suffix, void* data, size_t*
FILE *f = fopen(fileName, "rb");
if ( !f ) {
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_(%s)"'", fileName);
retval = 1;
goto out;
free(fileName);
return 1;
}
// get filesize in order to malloc memory
@ -310,7 +310,12 @@ int loadFile(const char *preferredName, const char *suffix, void* data, size_t*
out:
fclose(f);
if (data)
free(data);
free(fileName);
return retval;
}