From 5fe1e55d35413b1904cfcf16ec15495398921fe5 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sat, 21 Sep 2019 07:43:55 +0000 Subject: [PATCH] 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 llvm-svn: 372460 --- compiler-rt/test/asan/TestCases/inline.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler-rt/test/asan/TestCases/inline.cpp b/compiler-rt/test/asan/TestCases/inline.cpp index daeb7b49eb22a..12bd27e675844 100644 --- a/compiler-rt/test/asan/TestCases/inline.cpp +++ b/compiler-rt/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;