Issue 120072 - [From Symphony] There is a memory leak in function SvXMLExportItemMapper::QueryXMLValue
[From Symphony] There is a memory leak in function SvXMLExportItemMapper::Que...
Status: CLOSED FIXED
Product: performance
Classification: Code
Component: code
AOO 3.4.0
All All
: P3 normal (vote)
: AOO 4.0
Assigned To: zhang jianfang
:
Depends on:
Blocks: 120975 121366
  Show dependency treegraph
 
Reported: 2012-06-25 02:50 UTC by ChaoHuang
Modified: 2013-02-16 09:15 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
for file "main/sw/source/filter/xml/xmlexpit.cxx" (505 bytes, patch)
2012-06-25 02:57 UTC, ChaoHuang
zhangjf: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description ChaoHuang 2012-06-25 02:50:39 UTC
Code snippet
-----------------------------------------------------------------
case RES_FRAMEDIR:
        {
            Any aAny;
            bOk = rItem.QueryValue( aAny );
            if( bOk )
            {
                const XMLPropertyHandler* pWritingModeHandler =
                    XMLPropertyHandlerFactory::CreatePropertyHandler(
                        XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT );
                OUString sValue;
                bOk = pWritingModeHandler->exportXML( sValue, aAny,
                                                      rUnitConverter );
                if( bOk )
                    aOut.append( sValue );
            }
        }
        break;

The object pWritingModeHandler is created in function XMLPropertyHandlerFactory::CreatePropertyHandler on heap. But it will not be released. So it is a memory leak.
Comment 1 ChaoHuang 2012-06-25 02:57:58 UTC
Created attachment 78451 [details]
for file "main/sw/source/filter/xml/xmlexpit.cxx"
Comment 2 ChaoHuang 2012-06-25 02:58:41 UTC
Need to free pWritingModeHandler explicitly
Comment 3 zhang jianfang 2012-06-25 06:41:16 UTC
Comment on attachment 78451 [details]
for file "main/sw/source/filter/xml/xmlexpit.cxx"

I will review it
Comment 4 zhang jianfang 2012-06-25 07:03:44 UTC
Comment on attachment 78451 [details]
for file "main/sw/source/filter/xml/xmlexpit.cxx"

The fix works very well.
Comment 5 zhang jianfang 2012-06-25 07:05:43 UTC
Committed to 3.5 trunk by revision r1353406.
Comment 6 ChaoHuang 2012-10-17 08:14:06 UTC
Suggest to put it into AOO 3.5.0 release
Comment 7 Yan Ji 2012-11-30 04:47:04 UTC
Since last SVT(r1400866) shows there is no memory leak, so close this defect as resolved.