diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-06-08 07:31:19 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-06-08 07:31:19 +0200 |
commit | 684d79906ff8e84dc2872b33e65c7d8dc303bddf (patch) | |
tree | bce137d36f7daf0d7392d65037114760c34406af | |
parent | 0179d35fb3bcae57777d628087fd7adde357187a (diff) |
avoid memory leak and invalid documents
See e.g. fdo54757-1.xlsx exported to ods.
Change-Id: I81fb9a18519c5770b52dfb8131211e440ad9682f
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index cfd0c1f5c4ff..ab6290336b7b 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1210,7 +1210,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& } // chart element - SvXMLElementExport* pElChart = 0; + boost::scoped_ptr<SvXMLElementExport> pElChart; // get property states for autostyles if( mxExpPropMapper.is()) @@ -1283,7 +1283,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& AddAutoStyleAttribute( aPropertyStates ); //element - pElChart = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_CHART, true, true ); + pElChart.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_CHART, true, true )); } else // autostyles { @@ -1540,10 +1540,6 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& // #85929# always export table, otherwise clipboard may lose data exportTable(); } - - // close <chart:chart> element - if( pElChart ) - delete pElChart; } static void lcl_exportComplexLabel( const Sequence< uno::Any >& rComplexLabel, SvXMLExport& rExport ) @@ -1866,7 +1862,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( // plot-area element - SvXMLElementExport* pElPlotArea = 0; + boost::scoped_ptr<SvXMLElementExport> pElPlotArea; // get property states for autostyles xPropSet = Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ); if( xPropSet.is()) @@ -1956,7 +1952,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( } // plot-area element - pElPlotArea = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, true, true ); + pElPlotArea.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, true, true )); //inner position rectangle element exportCoordinateRegion( xDiagram ); @@ -2111,9 +2107,6 @@ void SchXMLExportHelper_Impl::exportPlotArea( } } } - - if( pElPlotArea ) - delete pElPlotArea; } void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< chart::XDiagram >& xDiagram ) |