From 5ccfef6a1d9a5d3fcea56d8900dd35931c793484 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 5 Oct 2013 11:53:20 +0000 Subject: lli: Plug leaks in the remote target external implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192031 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lli/ChildTarget/ChildTarget.cpp | 1 + tools/lli/ChildTarget/Unix/ChildTarget.inc | 4 ++++ tools/lli/ChildTarget/Windows/ChildTarget.inc | 3 +++ tools/lli/RemoteTargetExternal.h | 2 +- tools/lli/Unix/RemoteTargetExternal.inc | 4 ++++ tools/lli/Windows/RemoteTargetExternal.inc | 3 +++ 6 files changed, 16 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/lli/ChildTarget/ChildTarget.cpp b/tools/lli/ChildTarget/ChildTarget.cpp index a59209a160..55fcae9def 100644 --- a/tools/lli/ChildTarget/ChildTarget.cpp +++ b/tools/lli/ChildTarget/ChildTarget.cpp @@ -11,6 +11,7 @@ using namespace llvm; class LLIChildTarget { public: + ~LLIChildTarget(); // OS-specific destructor void initialize(); LLIMessageType waitForIncomingMessage(); void handleMessage(LLIMessageType messageType); diff --git a/tools/lli/ChildTarget/Unix/ChildTarget.inc b/tools/lli/ChildTarget/Unix/ChildTarget.inc index cd42f34edd..cc95810dc8 100644 --- a/tools/lli/ChildTarget/Unix/ChildTarget.inc +++ b/tools/lli/ChildTarget/Unix/ChildTarget.inc @@ -49,6 +49,10 @@ struct ConnectionData_t { } // namespace +LLIChildTarget::~LLIChildTarget() { + delete static_cast(ConnectionData); +} + // OS-specific methods void LLIChildTarget::initializeConnection() { // Store the parent ends of the pipes diff --git a/tools/lli/ChildTarget/Windows/ChildTarget.inc b/tools/lli/ChildTarget/Windows/ChildTarget.inc index bb95aff000..45db2b0a80 100644 --- a/tools/lli/ChildTarget/Windows/ChildTarget.inc +++ b/tools/lli/ChildTarget/Windows/ChildTarget.inc @@ -12,6 +12,9 @@ // //===----------------------------------------------------------------------===// +LLIChildTarget::~LLIChildTarget() { +} + // The RemoteTargetExternal implementation should prevent us from ever getting // here on Windows, but nothing prevents a user from running this directly. void LLIChildTarget::initializeConnection() { diff --git a/tools/lli/RemoteTargetExternal.h b/tools/lli/RemoteTargetExternal.h index 9a3644ac55..a4bfad2f12 100644 --- a/tools/lli/RemoteTargetExternal.h +++ b/tools/lli/RemoteTargetExternal.h @@ -88,7 +88,7 @@ public: virtual void stop(); RemoteTargetExternal(std::string &Name) : RemoteTarget(), ChildName(Name) {} - virtual ~RemoteTargetExternal() {} + virtual ~RemoteTargetExternal(); private: std::string ChildName; diff --git a/tools/lli/Unix/RemoteTargetExternal.inc b/tools/lli/Unix/RemoteTargetExternal.inc index e245f7e3a8..9c1a4cc315 100644 --- a/tools/lli/Unix/RemoteTargetExternal.inc +++ b/tools/lli/Unix/RemoteTargetExternal.inc @@ -89,4 +89,8 @@ void RemoteTargetExternal::Wait() { wait(NULL); } +RemoteTargetExternal::~RemoteTargetExternal() { + delete static_cast(ConnectionData); +} + } // namespace llvm diff --git a/tools/lli/Windows/RemoteTargetExternal.inc b/tools/lli/Windows/RemoteTargetExternal.inc index 6536d9974a..aef4627945 100644 --- a/tools/lli/Windows/RemoteTargetExternal.inc +++ b/tools/lli/Windows/RemoteTargetExternal.inc @@ -29,4 +29,7 @@ int RemoteTargetExternal::ReadBytes(void *Data, size_t Size) { void RemoteTargetExternal::Wait() { } +RemoteTargetExternal::~RemoteTargetExternal() { +} + } // namespace llvm -- cgit v1.2.3