[llvm-branch-commits] [llvm] 54a8365 - Follow up to 6e03a68b776dc, squelch another leak

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 8 10:29:42 PST 2022


Author: Jeremy Morse
Date: 2022-02-08T10:29:17-08:00
New Revision: 54a83652eebad6508fb861847fbb84606f37b502

URL: https://github.com/llvm/llvm-project/commit/54a83652eebad6508fb861847fbb84606f37b502
DIFF: https://github.com/llvm/llvm-project/commit/54a83652eebad6508fb861847fbb84606f37b502.diff

LOG: Follow up to 6e03a68b776dc, squelch another leak

This patch is a sticking-paster until D118774 solves the situation with
unique_ptrs. I'm certainly wishing I'd focused on that first X_X.

(cherry picked from commit 4654fa89eacca375ff860203697982b873bbd7c8)

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 3b4d717c9ab4a..6af5f07d801ac 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2929,8 +2929,15 @@ bool InstrRefBasedLDV::depthFirstVLocAndEmit(
   VTracker = nullptr;
 
   // No scopes? No variable locations.
-  if (!LS.getCurrentFunctionScope())
+  if (!LS.getCurrentFunctionScope()) {
+    // FIXME: this is a sticking plaster to prevent a memory leak, these
+    // pointers will be automagically freed by being unique pointers, shortly.
+    for (unsigned int I = 0; I < MaxNumBlocks; ++I) {
+      delete[] MInLocs[I];
+      delete[] MOutLocs[I];
+    }
     return false;
+  }
 
   // Build map from block number to the last scope that uses the block.
   SmallVector<unsigned, 16> EjectionMap;


        


More information about the llvm-branch-commits mailing list