[Lldb-commits] [lldb] r219771 - Make sure local var cu is non-NULL before dereferencing.

Jason Molenda jmolenda at apple.com
Tue Oct 14 20:07:39 PDT 2014


Author: jmolenda
Date: Tue Oct 14 22:07:39 2014
New Revision: 219771

URL: http://llvm.org/viewvc/llvm-project?rev=219771&view=rev
Log:
Make sure local var cu is non-NULL before dereferencing.
(it was checked for NULL-ness in some places, not in others)
clang static analyzer fixit.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Tue Oct 14 22:07:39 2014
@@ -555,7 +555,8 @@ static dw_offset_t DumpCallback
         if (dumpInfo->die_offset == DW_INVALID_OFFSET)
         {
             // We are dumping everything
-            cu->Dump(s);
+            if (cu)
+                cu->Dump(s);
             return cu->GetFirstDIEOffset(); // Return true to parse all DIEs in this Compile Unit
         }
         else
@@ -568,7 +569,7 @@ static dw_offset_t DumpCallback
 
             // We are dumping only a single DIE possibly with it's children and
             // we must find it's compile unit before we can dump it properly
-            if (dumpInfo->die_offset < cu->GetFirstDIEOffset())
+            if (cu && dumpInfo->die_offset < cu->GetFirstDIEOffset())
             {
                 // Not found, maybe the DIE offset provided wasn't correct?
             //  *ostrm_ptr << "DIE at offset " << HEX32 << dumpInfo->die_offset << " was not found." << endl;





More information about the lldb-commits mailing list