Skip to content

Commit

Permalink
Avoid memory leak in ASan test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
krytarowski committed Sep 21, 2019
1 parent 8827047 commit 5fe1e55
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compiler-rt/test/asan/TestCases/inline.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 5fe1e55

Please sign in to comment.