about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-04-01 01:58:34 +0200
committerDominik Maier <domenukk@gmail.com>2020-04-01 13:10:07 +0200
commit74b4096570f564c8f48880c9c19e3d2876405687 (patch)
treee7cb6098da6a23aa70ecaf4f0d27222abdaebb24 /src
parenteca55be4fb961bc65cf8c3531fe2e2eb2b7ca614 (diff)
downloadafl++-74b4096570f564c8f48880c9c19e3d2876405687.tar.gz
one less alloc
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-run.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c
index 8cef78b9..08d8b615 100644
--- a/src/afl-fuzz-run.c
+++ b/src/afl-fuzz-run.c
@@ -168,19 +168,15 @@ void write_to_testcase(afl_state_t *afl, void *mem, u32 len) {
 
 #ifdef _AFL_DOCUMENT_MUTATIONS
   s32   doc_fd;
-  char *fn = alloc_printf("%s/mutations/%09u:%s", afl->out_dir,
+  char fn[PATH_MAX];
+  snprintf(fn, PATH_MAX, ("%s/mutations/%09u:%s", afl->out_dir,
                           afl->document_counter++, describe_op(afl, 0));
-  if (fn != NULL) {
 
-    if ((doc_fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0600)) >= 0) {
+  if ((doc_fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0600)) >= 0) {
 
-      if (write(doc_fd, mem, len) != len)
-        PFATAL("write to mutation file failed: %s", fn);
-      close(doc_fd);
-
-    }
-
-    ck_free(fn);
+    if (write(doc_fd, mem, len) != len)
+      PFATAL("write to mutation file failed: %s", fn);
+    close(doc_fd);
 
   }