[PATCH] D67330: Avoid memory leak in ASan test

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 08:50:31 PDT 2019


krytarowski created this revision.
krytarowski added reviewers: joerg, mgorny, vitalybuka, dvyukov.
krytarowski added a project: Sanitizers.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Add missing free(3) for the malloc(3) call.

Detected on NetBSD with LSan.


Repository:
  rL LLVM

https://reviews.llvm.org/D67330

Files:
  test/asan/TestCases/inline.cpp


Index: test/asan/TestCases/inline.cpp
===================================================================
--- test/asan/TestCases/inline.cpp
+++ test/asan/TestCases/inline.cpp
@@ -13,6 +13,7 @@
 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67330.219270.patch
Type: text/x-patch
Size: 358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190908/47be4955/attachment.bin>


More information about the llvm-commits mailing list