[PATCH] D38564: llvm-cfi-verify fixed GraphBuilder memory leak.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 15:01:16 PDT 2017


hctim created this revision.

Fixed memleak when deleting orphaned nodes (clean up the whole chain instead of just the first node).

Thanks ASAN team >;)


https://reviews.llvm.org/D38564

Files:
  tools/llvm-cfi-verify/GraphBuilder.cpp


Index: tools/llvm-cfi-verify/GraphBuilder.cpp
===================================================================
--- tools/llvm-cfi-verify/GraphBuilder.cpp
+++ tools/llvm-cfi-verify/GraphBuilder.cpp
@@ -98,8 +98,12 @@
       CFNs.insert(FlowNode);
   }
 
-  for (const auto &FlowNode : OrphanedNodes)
-    CFNs.insert(FlowNode);
+  for (auto &FlowNode : OrphanedNodes) {
+    while (FlowNode) {
+      CFNs.insert(FlowNode);
+      FlowNode = FlowNode->Next;
+    }
+  }
 
   for (const auto &Node : CFNs)
     delete Node;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38564.117748.patch
Type: text/x-patch
Size: 525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171004/15aac9ee/attachment.bin>


More information about the llvm-commits mailing list