[Lldb-commits] [PATCH] D146412: [NFC] Fix potential for use-after-free in DumpModuleInfoAction

Mariya Podchishchaeva via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 29 10:59:08 PDT 2023


Fznamznon added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectTarget.cpp:2182-2183
 
-    clang::DumpModuleInfoAction dump_module_info;
-    dump_module_info.OutputStream = &result.GetOutputStream().AsRawOstream();
+    std::shared_ptr<llvm::raw_ostream> Out(
+        &result.GetOutputStream().AsRawOstream(), [](llvm::raw_ostream *) {});
+    clang::DumpModuleInfoAction dump_module_info(Out);
----------------
tahonermann wrote:
> Use of `std::shared_ptr` with a deleter that doesn't do anything is unusual; I think this deserves a comment.
Sure, done.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146412/new/

https://reviews.llvm.org/D146412



More information about the lldb-commits mailing list