[Lldb-commits] [lldb] r219890 - Ensure that user_exe_path is non-NULL before derferencing.

Jason Molenda jmolenda at apple.com
Wed Oct 15 18:42:11 PDT 2014


Author: jmolenda
Date: Wed Oct 15 20:42:11 2014
New Revision: 219890

URL: http://llvm.org/viewvc/llvm-project?rev=219890&view=rev
Log:
Ensure that user_exe_path is non-NULL before derferencing.
We've already created a FileSpec based on this local and 
this code path would never be executed if it is an invalid
FilePath - but the static analyzer doesn't know this and I
want to placate it.
clang static analyzer fixit.

Modified:
    lldb/trunk/source/Target/TargetList.cpp

Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=219890&r1=219889&r2=219890&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Wed Oct 15 20:42:11 2014
@@ -340,7 +340,7 @@ TargetList::CreateTarget (Debugger &debu
         if (file.GetFileType() == FileSpec::eFileTypeDirectory)
             user_exe_path_is_bundle = true;
 
-        if (file.IsRelativeToCurrentWorkingDirectory())
+        if (file.IsRelativeToCurrentWorkingDirectory() && user_exe_path)
         {
             // Ignore paths that start with "./" and "../"
             if (!((user_exe_path[0] == '.' && user_exe_path[1] == '/') ||





More information about the lldb-commits mailing list