summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2019-09-21 07:43:55 +0000
committerKamil Rytarowski <n54@gmx.com>2019-09-21 07:43:55 +0000
commit54f5dca4b6446825d51b1d0b4bd313079dbfda70 (patch)
treeb13c1a65c42365a9fd5da0cba6e8caa09e6ad0e6
parent96b852a95bebc7c2d9da09975a4764c365167621 (diff)
downloadcompiler-rt-54f5dca4b6446825d51b1d0b4bd313079dbfda70.tar.gz
Avoid memory leak in ASan test
Summary: Add missing free(3) for the malloc(3) call. Detected on NetBSD with LSan. Reviewers: joerg, mgorny, vitalybuka, dvyukov Reviewed By: vitalybuka Subscribers: llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D67330 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372460 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/asan/TestCases/inline.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/asan/TestCases/inline.cpp b/test/asan/TestCases/inline.cpp
index daeb7b49e..12bd27e67 100644
--- a/test/asan/TestCases/inline.cpp
+++ b/test/asan/TestCases/inline.cpp
@@ -13,6 +13,7 @@ int f(int *p) {
int main(int argc, char **argv) {
int * volatile x = (int*)malloc(2*sizeof(int) + 2);
int res = f(x + 2);
+ free(x);
if (res)
exit(0);
return 0;