Commit 5c32a47b964f8fb86070bcbb70c5fe6d9da8e28a

Con Kolivas 2013-03-01T14:29:20

Merge pull request #375 from luke-jr/bugfix_cfgwrite_fnleak Free filename entry for writing config file when done with it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/cgminer.c b/cgminer.c
index ee75187..958fcbe 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4324,6 +4324,7 @@ retry:
 			struct stat statbuf;
 
 			strcpy(filename, str);
+			free(str);
 			if (!stat(filename, &statbuf)) {
 				wlogprint("File exists, overwrite?\n");
 				input = getch();
@@ -4331,6 +4332,8 @@ retry:
 					goto retry;
 			}
 		}
+		else
+			free(str);
 		fcfg = fopen(filename, "w");
 		if (!fcfg) {
 			wlogprint("Cannot open or create file\n");