X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/8d0a3e87d7d2350f4a05698a42f57625e460e5d6..d3a22c7dfa87bf5e21d228849a602194be4a0895:/client/loclass/fileutils.c diff --git a/client/loclass/fileutils.c b/client/loclass/fileutils.c index 74c36a4d..443070c1 100644 --- a/client/loclass/fileutils.c +++ b/client/loclass/fileutils.c @@ -79,6 +79,7 @@ int saveFile(const char *preferredName, const char *suffix, const void* data, si FILE *fh=fopen(fileName,"wb"); if(!fh) { PrintAndLog("Failed to write to file '%s'", fileName); + free(fh); return 1; } fwrite(data, 1, datalen, fh); @@ -94,10 +95,12 @@ int loadFile(const char *fileName, void* data, size_t datalen) FILE *filehandle = fopen(fileName, "rb"); if(!filehandle) { PrintAndLog("Failed to read from file '%s'", fileName); + free(filehandle); return 1; } fread(data,datalen,1,filehandle); fclose(filehandle); + free(filehandle); return 0; } /**