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); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits