about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-02-18 10:35:27 +0100
committervan Hauser <vh@thc.org>2020-02-18 10:35:27 +0100
commitac08a38db993ef60937ae9c304dd1d418ddf5cb1 (patch)
treed60b8f7b5ac2e0fb4a5a4842c6df49ce66e6b8c7 /src
parent3e20edf10e5129e990c295b86e14d896c4a3ca48 (diff)
downloadafl++-ac08a38db993ef60937ae9c304dd1d418ddf5cb1.tar.gz
showmap: delete tmpfile on exit
Diffstat (limited to 'src')
-rw-r--r--src/afl-showmap.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 99022983..a46645ab 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -162,7 +162,7 @@ static void classify_counts(u8* mem, const u8* map) {
 
 static void at_exit_handler(void) {
 
-  if (out_file) unlink(out_file);                          /* Ignore errors */
+  if (stdin_file) unlink(stdin_file);
 
 }
 
@@ -949,7 +949,7 @@ int main(int argc, char** argv, char** envp) {
 
     }
 
-    stdin_file = alloc_printf("%s/.afl-tmin-temp-%u", use_dir, getpid());
+    stdin_file = alloc_printf("%s/.afl-showmap-temp-%u", use_dir, getpid());
     unlink(stdin_file);
     atexit(at_exit_handler);
     out_fd = open(stdin_file, O_RDWR | O_CREAT | O_EXCL, 0600);
@@ -1014,6 +1014,13 @@ int main(int argc, char** argv, char** envp) {
         tcnt, highest, total, out_file);
 
   }
+  
+  if (stdin_file) {
+  
+    unlink(stdin_file);
+    stdin_file = NULL;
+    
+  }
 
   exit(child_crashed * 2 + child_timed_out);