aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/test/LeakTest.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-04-20 00:24:21 +0000
committerKostya Serebryany <kcc@google.com>2016-04-20 00:24:21 +0000
commit1bfd583d82963cddf839fb0d8c9254cd3a967631 (patch)
tree59304c967c9b80d7de3e133f20de3311deb87dda /llvm/lib/Fuzzer/test/LeakTest.cpp
parentea0b1e7c17eee8b514c026fbb30dc515bdf1c4bd (diff)
downloadllvm-1bfd583d82963cddf839fb0d8c9254cd3a967631.zip
llvm-1bfd583d82963cddf839fb0d8c9254cd3a967631.tar.gz
llvm-1bfd583d82963cddf839fb0d8c9254cd3a967631.tar.bz2
[libFuzzer] added -detect_leaks flag (0 by default for now). When enabled, it will help finding leaks while fuzzing
llvm-svn: 266838
Diffstat (limited to 'llvm/lib/Fuzzer/test/LeakTest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/LeakTest.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/test/LeakTest.cpp b/llvm/lib/Fuzzer/test/LeakTest.cpp
index 69ff10b..22e5164 100644
--- a/llvm/lib/Fuzzer/test/LeakTest.cpp
+++ b/llvm/lib/Fuzzer/test/LeakTest.cpp
@@ -8,7 +8,10 @@
static volatile void *Sink;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- Sink = new int;
+ if (Size > 0 && *Data == 'H') {
+ Sink = new int;
+ Sink = nullptr;
+ }
return 0;
}