From 54f5dca4b6446825d51b1d0b4bd313079dbfda70 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sat, 21 Sep 2019 07:43:55 +0000 Subject: 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 --- test/asan/TestCases/inline.cpp | 1 + 1 file changed, 1 insertion(+) 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; -- cgit v1.2.1