fix memory leak in ccnx-tunnel
diff --git a/src/ccnx-tunnel.cpp b/src/ccnx-tunnel.cpp
index 5e4d322..6a7dd29 100644
--- a/src/ccnx-tunnel.cpp
+++ b/src/ccnx-tunnel.cpp
@@ -8,7 +8,7 @@
: CcnxWrapper()
, m_localPrefix("/")
{
- //refreshLocalPrefix();
+ refreshLocalPrefix();
}
CcnxTunnel::~CcnxTunnel()
@@ -28,11 +28,12 @@
}
int
-CcnxTunnel::sendInterest (const Name &interest, Closure *closure, const Selectors &selectors)
+CcnxTunnel::sendInterest (const Name &interest, const Closure *closure, const Selectors &selectors)
{
Name tunneledInterest = queryRoutableName(interest);
Closure *cp = new TunnelClosure(closure, this, interest);
CcnxWrapper::sendInterest(tunneledInterest, cp, selectors);
+ delete cp;
}
void
@@ -55,7 +56,6 @@
CcnxTunnel::publishContentObject(const Name &name, const Bytes &contentObject, int freshness)
{
Name tunneledName = m_localPrefix + name;
- cout << "Outer name " << tunneledName;
Bytes tunneledCo = createContentObject(tunneledName, head(contentObject), contentObject.size(), freshness);
return putToCcnd(tunneledCo);
}
@@ -129,6 +129,13 @@
{
}
+Closure *
+TunnelClosure::dup() const
+{
+ Closure *closure = new TunnelClosure(m_retry, *m_dataCallback, m_tunnel, m_originalInterest, *m_timeoutCallback);
+ return closure;
+}
+
void
TunnelClosure::runDataCallback(const Name &name, const Bytes &content)
{