X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/92d255d3dc8fb9e567f3db035918249e6d083c35..db4de4d82f2e4539b2528e604b7d82f79cc92f3a:/client/loclass/fileutils.c diff --git a/client/loclass/fileutils.c b/client/loclass/fileutils.c index 2f7b6b65..255aa313 100644 --- a/client/loclass/fileutils.c +++ b/client/loclass/fileutils.c @@ -18,7 +18,7 @@ int fileExists(const char *filename) { int saveFile(const char *preferredName, const char *suffix, const void* data, size_t datalen) { - int size = sizeof(char) * (strlen(preferredName)+strlen(suffix)+5); + int size = sizeof(char) * (strlen(preferredName)+strlen(suffix)+10); char * fileName = malloc(size); memset(fileName,0,size); @@ -34,12 +34,14 @@ int saveFile(const char *preferredName, const char *suffix, const void* data, si /*Opening file for writing in binary mode*/ FILE *fileHandle=fopen(fileName,"wb"); if(!fileHandle) { - prnlog("Failed to write to file '%s'", fileName); + PrintAndLog("Failed to write to file '%s'", fileName); + free(fileName); return 1; } fwrite(data, 1, datalen, fileHandle); fclose(fileHandle); - prnlog("Saved data to '%s'", fileName); + PrintAndLog(">Saved data to '%s'", fileName); + free(fileName); return 0;