aboutsummaryrefslogtreecommitdiff
path: root/custom_mutators
diff options
context:
space:
mode:
authorRumata888 <isennovskiy@gmail.com>2020-11-13 14:54:36 +0300
committerRumata888 <isennovskiy@gmail.com>2020-11-13 14:54:36 +0300
commit622f942555772c9d15569ecdd77a67d1a2f6bd78 (patch)
tree930979e07c4ab077eca09654a7988bc4fd0c9ea9 /custom_mutators
parentc05c5b787b77e537eae256905c13809f56d213d4 (diff)
downloadAFLplusplus-622f942555772c9d15569ecdd77a67d1a2f6bd78.tar.gz
Fixed memleaks, change exit to PFATAL
Diffstat (limited to 'custom_mutators')
-rw-r--r--custom_mutators/symcc/symcc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/custom_mutators/symcc/symcc.c b/custom_mutators/symcc/symcc.c
index 531a462b..54a7fbb0 100644
--- a/custom_mutators/symcc/symcc.c
+++ b/custom_mutators/symcc/symcc.c
@@ -110,13 +110,19 @@ void afl_custom_queue_new_entry(my_mutator_t * data,
u8 *fn = alloc_printf("%s", filename_new_queue);
if (!(stat(fn, &st) == 0 && S_ISREG(st.st_mode) && st.st_size)) {
+ ck_free(fn);
PFATAL("Couldn't find enqueued file: %s", fn);
}
if (afl_struct->fsrv.use_stdin) {
- if (pipe(pipefd) == -1) { exit(-1); }
+ if (pipe(pipefd) == -1) {
+
+ ck_free(fn);
+ PFATAL("Couldn't create a pipe for interacting with symcc child process");
+
+ }
}
@@ -135,6 +141,7 @@ void afl_custom_queue_new_entry(my_mutator_t * data,
ssize_t r = read(fd, data->mutator_buf, MAX_FILE);
DBG("fn=%s, fd=%d, size=%ld\n", fn, fd, r);
+ ck_free(fn);
if (r <= 0) return;
close(fd);
if (r > fcntl(pipefd[1], F_GETPIPE_SZ))
@@ -143,6 +150,8 @@ void afl_custom_queue_new_entry(my_mutator_t * data,
} else {
+ ck_free(fn);
+
PFATAL(
"Something happened to the enqueued file before sending its "
"contents to symcc binary");
@@ -150,7 +159,6 @@ void afl_custom_queue_new_entry(my_mutator_t * data,
}
close(pipefd[1]);
- ck_free(fn);
}