about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2021-04-30 13:36:35 +0200
committerDominik Maier <domenukk@gmail.com>2021-04-30 13:37:59 +0200
commit38f1394e3ab5ccacff07e27f370f3edf1ce77afb (patch)
tree3f0d1ff1da8b3152c82b0a5d5d70bf646ae0434e
parente9d2f72382cab75832721d859c3e731da071435d (diff)
downloadafl++-38f1394e3ab5ccacff07e27f370f3edf1ce77afb.tar.gz
error handling, freeing mem
-rw-r--r--src/afl-cc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index 1f89bac5..09009334 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -560,12 +560,14 @@ static void edit_params(u32 argc, char **argv, char **envp) {
     if (lto_mode && !have_c) {
 
       u8 *ld_path = strdup(AFL_REAL_LD);
-      if (!*ld_path) ld_path = "ld.lld";
+      if (!ld_path || !*ld_path) { ld_path = strdup("ld.lld"); }
+      if (!ld_path) { PFATAL("Could not allocate mem for ld_path"); }
 #if defined(AFL_CLANG_LDPATH) && LLVM_MAJOR >= 12
       cc_params[cc_par_cnt++] = alloc_printf("--ld-path=%s", ld_path);
 #else
       cc_params[cc_par_cnt++] = alloc_printf("-fuse-ld=%s", ld_path);
 #endif
+      free(ld_path);
 
       cc_params[cc_par_cnt++] = "-Wl,--allow-multiple-definition";