[Lldb-commits] [PATCH] D85396: Fix a small memory leak in VectorType.cpp and BlockPointer.cpp

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 5 22:52:49 PDT 2020


jasonmolenda updated this revision to Diff 283489.
jasonmolenda added a comment.

Update to std::unique_ptr -- thanks for the reminder!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85396

Files:
  lldb/source/DataFormatters/VectorType.cpp
  lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp


Index: lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -175,9 +175,10 @@
 
 bool lldb_private::formatters::BlockPointerSummaryProvider(
     ValueObject &valobj, Stream &s, const TypeSummaryOptions &) {
-  lldb_private::SyntheticChildrenFrontEnd *synthetic_children =
-      BlockPointerSyntheticFrontEndCreator(nullptr, valobj.GetSP());
-  if (!synthetic_children) {
+  std::unique_ptr<SyntheticChildrenFrontEnd> synthetic_children;
+  synthetic_children.reset(
+      BlockPointerSyntheticFrontEndCreator(nullptr, valobj.GetSP()));
+  if (!synthetic_children.get()) {
     return false;
   }
 
Index: lldb/source/DataFormatters/VectorType.cpp
===================================================================
--- lldb/source/DataFormatters/VectorType.cpp
+++ lldb/source/DataFormatters/VectorType.cpp
@@ -261,9 +261,10 @@
 
 bool lldb_private::formatters::VectorTypeSummaryProvider(
     ValueObject &valobj, Stream &s, const TypeSummaryOptions &) {
-  auto synthetic_children =
-      VectorTypeSyntheticFrontEndCreator(nullptr, valobj.GetSP());
-  if (!synthetic_children)
+  std::unique_ptr<SyntheticChildrenFrontEnd> synthetic_children;
+  synthetic_children.reset(
+      VectorTypeSyntheticFrontEndCreator(nullptr, valobj.GetSP()));
+  if (!synthetic_children.get())
     return false;
 
   synthetic_children->Update();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85396.283489.patch
Type: text/x-patch
Size: 1530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200806/bdc0a513/attachment.bin>


More information about the lldb-commits mailing list