From: Alexey K. <akh...@us...> - 2008-05-30 16:53:33
|
Update of /cvsroot/aaf/AAF/ref-impl/src/impl In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv6783/ref-impl/src/impl Modified Files: ImplEnumAAFPropertyValues.cpp Log Message: Fix memory leaks - In GetElementValueFromSet() an object returned by CreateImpl() is already reference counted, no need for extra AcquireReference(). Fix the destructor to delete _pDefSet. Index: ImplEnumAAFPropertyValues.cpp =================================================================== RCS file: /cvsroot/aaf/AAF/ref-impl/src/impl/ImplEnumAAFPropertyValues.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ImplEnumAAFPropertyValues.cpp 24 May 2006 18:01:54 -0000 1.9 --- ImplEnumAAFPropertyValues.cpp 30 May 2008 16:53:38 -0000 1.10 *************** *** 14,18 **** // under the License. // ! // The Original Code of this file is Copyright 1998-2004, Licensor of the // AAF Association. // --- 14,18 ---- // under the License. // ! // The Original Code of this file is Copyright 1998-2008, Licensor of the // AAF Association. // *************** *** 91,97 **** }; - // Done. AcquireReference and return pointer. - pElemValData->AcquireReference(); *ppItemVal = pElemValData; return AAFRESULT_SUCCESS; } --- 91,99 ---- }; *ppItemVal = pElemValData; + (*ppItemVal)->AcquireReference(); + + pElemValData->ReleaseReference(); + return AAFRESULT_SUCCESS; } *************** *** 108,111 **** --- 110,118 ---- ImplEnumAAFPropertyValues::~ImplEnumAAFPropertyValues () { + if ( _pDefSet ) { + _pDefSet->ReleaseReference(); + _pDefSet = 0; + } + if ( _pDef ) { _pDef->ReleaseReference(); |