Author: veithm
Date: Tue Mar 18 13:49:03 2014
New Revision: 1578894

URL: http://svn.apache.org/r1578894
Log:
Fixing memory leak on getRemoteAddress calls

GetRemoteAddress returns a char array which needs to be deleted by
the caller.

Change-Id: I379b3efca6620e8f8f2f63a8218cc83765020ac7

Modified:
    etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp
    etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp

Modified: 
etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp
URL: 
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp?rev=1578894&r1=1578893&r2=1578894&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp 
(original)
+++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp Tue 
Mar 18 13:49:03 2014
@@ -138,6 +138,8 @@ status_t EtchTcpConnection::openSocket(c
       status_t result = mSocket->getRemoteAddress(&remoteAddress);
 
       ETCH_LOG_DEBUG(mRuntime->getLogger(), 
mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " 
=> Connection established to remote " << remoteAddress);
+      delete[] remoteAddress;
+
       return ETCH_OK;
     } else {
       mSocket->close();

Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
URL: 
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp?rev=1578894&r1=1578893&r2=1578894&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp 
(original)
+++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp Tue 
Mar 18 13:49:03 2014
@@ -152,6 +152,7 @@ status_t EtchTcpListener::readSocket() {
       capu::char_t* remoteAddress = NULL;
       status_t result = s->getRemoteAddress(&remoteAddress);
       ETCH_LOG_DEBUG(mRuntime->getLogger(), 
mRuntime->getLogger().getTransportContext(), "A new connection from " << 
remoteAddress << " has been accepted");
+      delete[] remoteAddress;
       mSession->sessionAccepted(s);
     } else {
       delete s;


Reply via email to