In the destructor, free the memory allocated for elementReader_.partialData.
diff --git a/ndn-cpp/transport/tcp-transport.cpp b/ndn-cpp/transport/tcp-transport.cpp
index 4552cfe..aa438bc 100644
--- a/ndn-cpp/transport/tcp-transport.cpp
+++ b/ndn-cpp/transport/tcp-transport.cpp
@@ -59,4 +59,11 @@
     throw std::runtime_error(ndn_getErrorString(error));  
 }
 
+TcpTransport::~TcpTransport()
+{
+  if (elementReader_.partialData.array)
+    // Free the memory allocated in connect.
+    free(elementReader_.partialData.array);
+}
+
 }