[Lldb-commits] [lldb] r303991 - Fixing Memory Leak
Ravitheja Addepally via lldb-commits
lldb-commits at lists.llvm.org
Fri May 26 07:26:14 PDT 2017
Author: ravitheja
Date: Fri May 26 09:26:14 2017
New Revision: 303991
URL: http://llvm.org/viewvc/llvm-project?rev=303991&view=rev
Log:
Fixing Memory Leak
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=303991&r1=303990&r2=303991&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Fri May 26 09:26:14 2017
@@ -1300,13 +1300,13 @@ GDBRemoteCommunicationServerLLGS::Handle
json_dict->GetValueForKeyAsInteger("threadid", tid);
// Allocate the response buffer.
- uint8_t *buffer = new (std::nothrow) uint8_t[byte_count];
- if (buffer == nullptr)
+ std::unique_ptr<uint8_t[]> buffer (new (std::nothrow) uint8_t[byte_count]);
+ if (!buffer)
return SendErrorResponse(0x78);
StreamGDBRemote response;
Status error;
- llvm::MutableArrayRef<uint8_t> buf(buffer, byte_count);
+ llvm::MutableArrayRef<uint8_t> buf(buffer.get(), byte_count);
if (tracetype == BufferData)
error = m_debugged_process_sp->GetData(uid, tid, buf, offset);
More information about the lldb-commits
mailing list