diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-08 14:13:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-08 18:20:06 +0100 |
commit | 5ceea51947b99f27eb3401bd3c9b8a7cf6ee9c96 (patch) | |
tree | afd5268328b28ae2a4c276c896baad4a97245240 /sw | |
parent | 3ba914c229adfed5c917d1ee23d35b9184b092c4 (diff) |
ofz: fix mem leak
Change-Id: I295e52723297b257dcfe532108471702631ca5f5
Reviewed-on: https://gerrit.libreoffice.org/46093
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/html/htmltab.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 5a5b028f9ad9..11d47a4514f0 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -398,7 +398,7 @@ class HTMLTable const SwStartNode *m_pPrevStartNode; // the Table-Node or the Start-Node of the section before const SwTable *m_pSwTable; // SW-Table (only on Top-Level) - SwTableBox *m_pBox1; // TableBox, generated when the Top-Level-Table was build + std::unique_ptr<SwTableBox> m_xBox1; // TableBox, generated when the Top-Level-Table was build SwTableBoxFormat *m_pBoxFormat; // frame::Frame-Format from SwTableBox SwTableLineFormat *m_pLineFormat; // frame::Frame-Format from SwTableLine SwTableLineFormat *m_pLineFrameFormatNoHeight; @@ -928,7 +928,7 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions ) m_nRows = 0; m_nCurrentRow = 0; m_nCurrentColumn = 0; - m_pBox1 = nullptr; + m_xBox1.reset(); m_pBoxFormat = nullptr; m_pLineFormat = nullptr; m_pLineFrameFormatNoHeight = nullptr; m_pInheritedBackgroundBrush = nullptr; @@ -1526,13 +1526,11 @@ SwTableBox *HTMLTable::NewTableBox( const SwStartNode *pStNd, { SwTableBox *pBox; - if( m_pTopTable->m_pBox1 && - m_pTopTable->m_pBox1->GetSttNd() == pStNd ) + if (m_pTopTable->m_xBox1 && m_pTopTable->m_xBox1->GetSttNd() == pStNd) { // If the StartNode is the StartNode of the initially created box, we take that box - pBox = m_pTopTable->m_pBox1; - pBox->SetUpper( pUpper ); - m_pTopTable->m_pBox1 = nullptr; + pBox = m_pTopTable->m_xBox1.release(); + pBox->SetUpper(pUpper); } else pBox = new SwTableBox( m_pBoxFormat, *pStNd, pUpper ); @@ -2427,11 +2425,11 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, { // remember the first box and unlist it from the first row SwTableLine *pLine1 = (m_pSwTable->GetTabLines())[0]; - m_pBox1 = (pLine1->GetTabBoxes())[0]; + m_xBox1.reset((pLine1->GetTabBoxes())[0]); pLine1->GetTabBoxes().erase(pLine1->GetTabBoxes().begin()); m_pLineFormat = static_cast<SwTableLineFormat*>(pLine1->GetFrameFormat()); - m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_pBox1->GetFrameFormat()); + m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_xBox1->GetFrameFormat()); } else { |