[Lldb-commits] [lldb] Fix a potential use-after-free in StopInfoBreakpoint. (PR #163471)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 15 09:07:48 PDT 2025


================
@@ -164,6 +173,14 @@ class BreakpointLocationCollection {
 
   collection m_break_loc_collection;
   mutable std::mutex m_collection_mutex;
+  /// These are used if we're preserving breakpoints in this list:
+  const bool m_preserving_bkpts = false;
+  struct RefCountedBPSP {
+    RefCountedBPSP(lldb::BreakpointSP in_bp_sp) : ref_cnt(1), bp_sp(in_bp_sp) {}
+    uint64_t ref_cnt;
----------------
JDevlieghere wrote:

Why do we need our own refcount? The shared pointer already maintains a ref count. Why can't we use that? This seems like a recipe for leaks if we don't remember to keep the two in sync. 

https://github.com/llvm/llvm-project/pull/163471


More information about the lldb-commits mailing list