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

Jason Molenda jason at molenda.com
Wed Oct 15 01:41:30 PDT 2014


On Oct 14, 2014, at 8:56 PM, Bruce Mitchener <bruce.mitchener at gmail.com> wrote:

> On Wed, Oct 15, 2014 at 10:07 AM, Jason Molenda <jmolenda at apple.com> wrote:
> 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
> 
> This one doesn't make sense ... if you check it for cu->Dump, but the very next line outside of the if statement is the return cu->GetFirstDIEOffset() ...


You're right, thanks for calling that out Bruce.  I'll fix it tomorrow.  I didn't have a chance to re-run the analyzer to get a clear pass on the file before heading home.



More information about the lldb-commits mailing list