about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-04-10 16:45:45 +0200
committerhexcoder- <heiko@hexco.de>2020-04-10 16:45:45 +0200
commit6aa6af04acb8f024696e8723e6d73514006b3dd5 (patch)
tree03a2fb69279d184d3ae7a93bca41f72a27217865
parent5b977453cbff9778335eabaa5c2f808291a495ed (diff)
downloadafl++-6aa6af04acb8f024696e8723e6d73514006b3dd5.tar.gz
files opened with fdopen should be closed with fclose
-rw-r--r--src/afl-forkserver.c2
-rw-r--r--src/afl-fuzz-cmplog.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index 11b359da..b3b86685 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -253,7 +253,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv) {
 #ifndef HAVE_ARC4RANDOM
     close(fsrv->dev_urandom_fd);
 #endif
-    close(fsrv->plot_file == NULL ? -1 : fileno(fsrv->plot_file));
+    if (fsrv->plot_file != NULL) fclose(fsrv->plot_file);
 
     /* This should improve performance a bit, since it stops the linker from
        doing extra work post-fork(). */
diff --git a/src/afl-fuzz-cmplog.c b/src/afl-fuzz-cmplog.c
index f932f33b..98f7db05 100644
--- a/src/afl-fuzz-cmplog.c
+++ b/src/afl-fuzz-cmplog.c
@@ -121,7 +121,7 @@ void init_cmplog_forkserver(afl_state_t *afl) {
 #ifndef HAVE_ARC4RANDOM
     close(afl->fsrv.dev_urandom_fd);
 #endif
-    close(afl->fsrv.plot_file == NULL ? -1 : fileno(afl->fsrv.plot_file));
+    if (afl->fsrv.plot_file != NULL) fclose(afl->fsrv.plot_file);
 
     /* This should improve performance a bit, since it stops the linker from
        doing extra work post-fork(). */