lli: Plug leaks in the remote target external implementation.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 5 Oct 2013 11:53:20 +0000 (11:53 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 5 Oct 2013 11:53:20 +0000 (11:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192031 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/ChildTarget/ChildTarget.cpp
tools/lli/ChildTarget/Unix/ChildTarget.inc
tools/lli/ChildTarget/Windows/ChildTarget.inc
tools/lli/RemoteTargetExternal.h
tools/lli/Unix/RemoteTargetExternal.inc
tools/lli/Windows/RemoteTargetExternal.inc

index a59209a160c3044bf3b15f889fe46fc13dede745..55fcae9def8fab51a54490a00f0e2e70a6951a2e 100644 (file)
@@ -11,6 +11,7 @@ using namespace llvm;
 
 class LLIChildTarget {
 public:
+  ~LLIChildTarget(); // OS-specific destructor
   void initialize();
   LLIMessageType waitForIncomingMessage();
   void handleMessage(LLIMessageType messageType);
index cd42f34edd53af214fe48e78971751023c470ffd..cc95810dc8c6bf305b890d070a73e616ffe9451a 100644 (file)
@@ -49,6 +49,10 @@ struct ConnectionData_t {
 
 } // namespace
 
+LLIChildTarget::~LLIChildTarget() {
+  delete static_cast<ConnectionData_t *>(ConnectionData);
+}
+
 // OS-specific methods
 void LLIChildTarget::initializeConnection() {
   // Store the parent ends of the pipes
index bb95aff000c005c7db03042593815971a5b4726f..45db2b0a808164b4c0684b013de4f7fb0ca629c8 100644 (file)
@@ -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() {
index 9a3644ac550634847dee4a68a211fd1f5e69c575..a4bfad2f12f28edcbe36bc1e50f2511f791487a8 100644 (file)
@@ -88,7 +88,7 @@ public:
   virtual void stop();
 
   RemoteTargetExternal(std::string &Name) : RemoteTarget(), ChildName(Name) {}
-  virtual ~RemoteTargetExternal() {}
+  virtual ~RemoteTargetExternal();
 
 private:
   std::string ChildName;
index e245f7e3a816a5ae3d2c647121e2090febc85eea..9c1a4cc3155357d8a2126aecd8252027e652bd12 100644 (file)
@@ -89,4 +89,8 @@ void RemoteTargetExternal::Wait() {
   wait(NULL);
 }
 
+RemoteTargetExternal::~RemoteTargetExternal() {
+  delete static_cast<ConnectionData_t *>(ConnectionData);
+}
+
 } // namespace llvm
index 6536d9974a0a664a8e2b44ef986e1b6bfad00c24..aef46279455a5614d480543d2413806259f06d77 100644 (file)
@@ -29,4 +29,7 @@ int RemoteTargetExternal::ReadBytes(void *Data, size_t Size) {
 void RemoteTargetExternal::Wait() {
 }
 
+RemoteTargetExternal::~RemoteTargetExternal() {
+}
+
 } // namespace llvm