[Lldb-commits] [lldb] 2cfcbe2 - [LLDB][NFC] Fix possible resource leak

Slava Gurevich via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 27 13:19:29 PDT 2022


Author: Slava Gurevich
Date: 2022-07-27T13:19:13-07:00
New Revision: 2cfcbe295a313846222ac9b35b14a261e77a89a8

URL: https://github.com/llvm/llvm-project/commit/2cfcbe295a313846222ac9b35b14a261e77a89a8
DIFF: https://github.com/llvm/llvm-project/commit/2cfcbe295a313846222ac9b35b14a261e77a89a8.diff

LOG: [LLDB][NFC] Fix possible resource leak

SymbolVendorPECOFF object is leaked on early return at line 110

Differential Revision: https://reviews.llvm.org/D130655

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp b/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp
index 9b651243152c9..0f8d3108998da 100644
--- a/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp
+++ b/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp
@@ -102,8 +102,6 @@ SymbolVendorPECOFF::CreateInstance(const lldb::ModuleSP &module_sp,
   // This objfile is for debugging purposes.
   dsym_objfile_sp->SetType(ObjectFile::eTypeDebugInfo);
 
-  SymbolVendorPECOFF *symbol_vendor = new SymbolVendorPECOFF(module_sp);
-
   // Get the module unified section list and add our debug sections to
   // that.
   SectionList *module_section_list = module_sp->GetSectionList();
@@ -132,6 +130,7 @@ SymbolVendorPECOFF::CreateInstance(const lldb::ModuleSP &module_sp,
     }
   }
 
+  SymbolVendorPECOFF *symbol_vendor = new SymbolVendorPECOFF(module_sp);
   symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp);
   return symbol_vendor;
 }


        


More information about the lldb-commits mailing list