[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-protocol-cvs
Subject: [Protocol-cvs] transport/rdt rdttran.cpp,1.23,1.24
From: rkondru () helixcommunity ! org
Date: 2009-02-20 22:46:05
Message-ID: 200902202250.n1KModuY012925 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/protocol/transport/rdt
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv12308
Modified Files:
rdttran.cpp
Log Message:
"Nokia submits this code under the terms of a commercial contribution
agreement with RealNetworks, and I am authorized to contribute this
code under said agreement."
Modified by: ext-ramesh.kondru@nokia.com
Reviewed by: Eric Hyche (ehyche@real.com)
Date: 01/27/2009
Project: SymbianMmf_wm
ErrorId: N/A
Synopsis: Memory Leak Fix - Memory leak fix under common and transport protocol \
module.
Overview:
Leak is fixed in two places. One in rdtran.cpp and otherone in clientpq.cpp.
rdtran.cpp -> Leak was created in HX_RESULT TNGUDPTransport::writePacket(BYTE* \
pData, UINT32 dataLen) here pData is not getting released after sending the request.
clientpq.cpp -> Leak was created because of some unreleased "PQElem" elements \
which are created from PQ::enter. Few packet elements are remaining during \
destruction which are not released. Fix is also related to C++ virtual method.
In ClientPQ::~ClientPQ() we are freeing "m_pFreeList" and then calling \
PQ::destruct(). Here in PQ::destruct() we clean elements in linked list/buckets, \
during this process in PQ::destruct() we call free_elem(pElem) which in turn calls \
ClientPQ::free_elem(PQElem*& pElem). Since we are calling "PQ::destruct" from \
"ClientPQ" context call goes to ClientPQ::free_elem(PQElem*& pElem) rather our \
intension I guess should be virtual void free_elem(PQElem*& pElem) { delete pElem; \
} in pq.h which does actual deletion.
In ClientPQ::free_elem(PQElem*& pElem) : We add pElem to "m_pFreeList" but \
m_pFreeList is already cleaned in ClientPQ::~ClientPQ() before calling PQ:destructor. \
And we don't clean "m_pFreeList" which remains as leak.
To correct this I have moved up "PQ::destruct()" in ClientPQ::~ClientPQ(). This \
way mFreeList will not get added with free nodes.
Files modified: cvsroot\protocol\transport\rdt\rdttran.cpp
cvsroot\client\common\system\clientpq.cpp
Files added: None
Image Size and Heap Use impact: None.
Module Release testing (STIF) : Yes
Test case(s) Added : No
Memory leak check performed : Yes. No new memory leaks introduced. But old leaks \
fixed.
Platforms and Profiles Build Verified: helix-client-s60-50-mmf-mdf-arm-dsp
Platforms and Profiles Functionality verified: armv5, winscw
Branch: HEAD
Index: rdttran.cpp
===================================================================
RCS file: /cvsroot/protocol/transport/rdt/rdttran.cpp,v
retrieving revision 1.23
diff -u -b -r1.23 rdttran.cpp
--- rdttran.cpp 17 Dec 2008 19:22:39 -0000 1.23
+++ rdttran.cpp 27 Jan 2009 17:19:54 -0000
@@ -1817,6 +1817,7 @@
rc = m_pUDPSocket->Write(pSendBuffer);
HX_RELEASE(pSendBuffer);
}
+ delete[] pData;
return rc;
}
Index: clientpq.cpp
===================================================================
RCS file: /cvsroot/client/common/system/clientpq.cpp,v
retrieving revision 1.11
diff -u -b -r1.11 clientpq.cpp
--- clientpq.cpp 7 Sep 2008 11:07:07 -0000 1.11
+++ clientpq.cpp 19 Feb 2009 17:31:23 -0000
@@ -93,6 +93,9 @@
// protect cleanup
m_pMutex->Lock();
+ // destruct base object under thread-safe lock
+ PQ::destruct();
+
while(m_pFreeList)
{
PQElem* pElem = m_pFreeList;
@@ -100,9 +103,6 @@
delete pElem;
}
- // destruct base object under thread-safe lock
- PQ::destruct();
-
m_pMutex->Unlock();
HX_RELEASE(m_pMutex);
}
Index: rdttran.cpp
===================================================================
RCS file: /cvsroot/protocol/transport/rdt/rdttran.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- rdttran.cpp 17 Dec 2008 19:22:39 -0000 1.23
+++ rdttran.cpp 20 Feb 2009 22:46:03 -0000 1.24
@@ -1817,6 +1817,7 @@
rc = m_pUDPSocket->Write(pSendBuffer);
HX_RELEASE(pSendBuffer);
}
+ delete[] pData;
return rc;
}
_______________________________________________
Protocol-cvs mailing list
Protocol-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/protocol-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic