X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/40148ab609cdcf58ae6ef517c319a758006e1c6d..c631b1a216099f929a15193ec5841d980e8be8d0:/client/loclass/fileutils.c?ds=inline

diff --git a/client/loclass/fileutils.c b/client/loclass/fileutils.c
index e5e5c5b0..fd18b964 100644
--- a/client/loclass/fileutils.c
+++ b/client/loclass/fileutils.c
@@ -77,17 +77,19 @@ int saveFile(const char *preferredName, const char *suffix, const void* data, si
 	/* We should have a valid filename now, e.g. dumpdata-3.bin */
 
 	/*Opening file for writing in binary mode*/
-	FILE *fileHandle=fopen(fileName,"wb");
-	if(!fileHandle) {
+	FILE *f = fopen(fileName,"wb");
+	if (!f) {
 		prnlog("Failed to write to file '%s'", fileName);
 		free(fileName);
 		return 1;
 	}
-	fwrite(data, 1,	datalen, fileHandle);
-	fclose(fileHandle);
+	fwrite(data, 1,	datalen, f);
+	if (f) {
+		fclose(f);
+		f = NULL;
+	}
 	prnlog("Saved data to '%s'", fileName);
 	free(fileName);
-
 	return 0;
 }