summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test/LeakTest.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-02-04 00:02:17 +0000
committerKostya Serebryany <kcc@google.com>2016-02-04 00:02:17 +0000
commitb92602ada08cf67440501e77a3844192bbecfcf2 (patch)
treebf79a317259a32ea3f871549ae1b9a270a0de893 /llvm/lib/Fuzzer/test/LeakTest.cpp
parent2432bd0ddd59b1ea99872b5ce6a8dc9781a55550 (diff)
downloadbcm5719-llvm-b92602ada08cf67440501e77a3844192bbecfcf2.tar.gz
bcm5719-llvm-b92602ada08cf67440501e77a3844192bbecfcf2.zip
[libFuzzer] don't write the test unit when a leak is detected (since we don't know which unit causes the leak)
llvm-svn: 259731
Diffstat (limited to 'llvm/lib/Fuzzer/test/LeakTest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/LeakTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/LeakTest.cpp b/llvm/lib/Fuzzer/test/LeakTest.cpp
new file mode 100644
index 00000000000..7d153e45691
--- /dev/null
+++ b/llvm/lib/Fuzzer/test/LeakTest.cpp
@@ -0,0 +1,11 @@
+// Test with a leak.
+#include <cstdint>
+#include <cstddef>
+
+static volatile void *Sink;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ Sink = new int;
+ return 0;
+}
+
OpenPOWER on IntegriCloud