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