lli: Plug leaks in the remote target external implementation.

llvm-svn: 192031
diff --git a/llvm/tools/lli/ChildTarget/ChildTarget.cpp b/llvm/tools/lli/ChildTarget/ChildTarget.cpp
index a59209a..55fcae9 100644
--- a/llvm/tools/lli/ChildTarget/ChildTarget.cpp
+++ b/llvm/tools/lli/ChildTarget/ChildTarget.cpp
@@ -11,6 +11,7 @@
 
 class LLIChildTarget {
 public:
+  ~LLIChildTarget(); // OS-specific destructor
   void initialize();
   LLIMessageType waitForIncomingMessage();
   void handleMessage(LLIMessageType messageType);
diff --git a/llvm/tools/lli/ChildTarget/Unix/ChildTarget.inc b/llvm/tools/lli/ChildTarget/Unix/ChildTarget.inc
index cd42f34..cc95810 100644
--- a/llvm/tools/lli/ChildTarget/Unix/ChildTarget.inc
+++ b/llvm/tools/lli/ChildTarget/Unix/ChildTarget.inc
@@ -49,6 +49,10 @@
 
 } // namespace
 
+LLIChildTarget::~LLIChildTarget() {
+  delete static_cast<ConnectionData_t *>(ConnectionData);
+}
+
 // OS-specific methods
 void LLIChildTarget::initializeConnection() {
   // Store the parent ends of the pipes
diff --git a/llvm/tools/lli/ChildTarget/Windows/ChildTarget.inc b/llvm/tools/lli/ChildTarget/Windows/ChildTarget.inc
index bb95aff..45db2b0 100644
--- a/llvm/tools/lli/ChildTarget/Windows/ChildTarget.inc
+++ b/llvm/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/llvm/tools/lli/RemoteTargetExternal.h b/llvm/tools/lli/RemoteTargetExternal.h
index 9a3644a..a4bfad2 100644
--- a/llvm/tools/lli/RemoteTargetExternal.h
+++ b/llvm/tools/lli/RemoteTargetExternal.h
@@ -88,7 +88,7 @@
   virtual void stop();
 
   RemoteTargetExternal(std::string &Name) : RemoteTarget(), ChildName(Name) {}
-  virtual ~RemoteTargetExternal() {}
+  virtual ~RemoteTargetExternal();
 
 private:
   std::string ChildName;
diff --git a/llvm/tools/lli/Unix/RemoteTargetExternal.inc b/llvm/tools/lli/Unix/RemoteTargetExternal.inc
index e245f7e..9c1a4cc 100644
--- a/llvm/tools/lli/Unix/RemoteTargetExternal.inc
+++ b/llvm/tools/lli/Unix/RemoteTargetExternal.inc
@@ -89,4 +89,8 @@
   wait(NULL);
 }
 
+RemoteTargetExternal::~RemoteTargetExternal() {
+  delete static_cast<ConnectionData_t *>(ConnectionData);
+}
+
 } // namespace llvm
diff --git a/llvm/tools/lli/Windows/RemoteTargetExternal.inc b/llvm/tools/lli/Windows/RemoteTargetExternal.inc
index 6536d99..aef4627 100644
--- a/llvm/tools/lli/Windows/RemoteTargetExternal.inc
+++ b/llvm/tools/lli/Windows/RemoteTargetExternal.inc
@@ -29,4 +29,7 @@
 void RemoteTargetExternal::Wait() {
 }
 
+RemoteTargetExternal::~RemoteTargetExternal() {
+}
+
 } // namespace llvm