[Lldb-commits] [lldb] r203359 - POSIX: fix possible API misuse

Saleem Abdulrasool compnerd at compnerd.org
Sat Mar 8 12:47:12 PST 2014


Author: compnerd
Date: Sat Mar  8 14:47:12 2014
New Revision: 203359

URL: http://llvm.org/viewvc/llvm-project?rev=203359&view=rev
Log:
POSIX: fix possible API misuse

memcpy cannot be passed NULL.  Ensuring that the destination pointer is non-NULL
requires checking success.  Rather than performing the success check at that
point, increasing indentation an additional level, fold it into the previous
statement.

Modified:
    lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp

Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp?rev=203359&r1=203358&r2=203359&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp Sat Mar  8 14:47:12 2014
@@ -347,12 +347,12 @@ RegisterContextPOSIXProcessMonitor_x86_6
 
         if (success)
         {
-            ::memcpy (dst, &m_gpr_x86_64, GetGPRSize());
-            dst += GetGPRSize();
+          ::memcpy (dst, &m_gpr_x86_64, GetGPRSize());
+          dst += GetGPRSize();
+          if (GetFPRType() == eFXSAVE)
+              ::memcpy (dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
         }
-        if (GetFPRType() == eFXSAVE)
-            ::memcpy (dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-        
+
         if (GetFPRType() == eXSAVE)
         {
             ByteOrder byte_order = GetByteOrder();





More information about the lldb-commits mailing list