From c4df8b1390da6b59f9d410a10905b2face807b00 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 14 Jun 2020 12:48:47 +0000 Subject: fix leaks in fuzz tests --- tests/fuzz/fuzzer.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests/fuzz/fuzzer.h') diff --git a/tests/fuzz/fuzzer.h b/tests/fuzz/fuzzer.h index 2d0a29dfc..fac7e474a 100644 --- a/tests/fuzz/fuzzer.h +++ b/tests/fuzz/fuzzer.h @@ -66,8 +66,12 @@ extern "C" { \ catch (const std::exception &e) \ { \ fprintf(stderr, "Exception: %s\n", e.what()); \ - return 1; \ + delete el::base::elStorage; \ + el::base::elStorage = NULL; \ + return 0; \ } \ + delete el::base::elStorage; \ + el::base::elStorage = NULL; \ return 0; \ } \ } @@ -122,8 +126,12 @@ int run_fuzzer(int argc, const char **argv, Fuzzer &fuzzer); catch (const std::exception &e) \ { \ fprintf(stderr, "Exception: %s\n", e.what()); \ - return 1; \ + delete el::base::elStorage; \ + el::base::elStorage = NULL; \ + return 0; \ } \ + delete el::base::elStorage; \ + el::base::elStorage = NULL; \ return 0; \ } \ }; \ -- cgit v1.2.3 From bde7f1c5cc6fe14c03116bf69b714ffcc8014fd1 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 14 Jun 2020 16:10:23 +0000 Subject: fuzz_tests: fix init check in oss-fuzz mode --- tests/fuzz/fuzzer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/fuzz/fuzzer.h') diff --git a/tests/fuzz/fuzzer.h b/tests/fuzz/fuzzer.h index fac7e474a..ce230fb66 100644 --- a/tests/fuzz/fuzzer.h +++ b/tests/fuzz/fuzzer.h @@ -56,7 +56,7 @@ extern "C" { \ static bool first = true; \ if (first) \ { \ - if (!init()) \ + if (init()) \ return 1; \ first = false; \ } \ -- cgit v1.2.3