summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-25 10:18:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-01-25 14:41:38 +0100
commit404a2ff6222228877087233bbe1f2a1544a46d8a (patch)
tree2e9afcd1af45aedb9635448ed931ac6039afa91b /sw
parent652c963b6ea84b94cd26b4c00874cea24a82c3f4 (diff)
ofz#4849 Direct leak
Change-Id: If9b7f6de42d99c76165aec775b8cde2505df0c62 Reviewed-on: https://gerrit.libreoffice.org/48561 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/swhtml.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 4115bb6f9e6b..3cb67e703bef 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -674,14 +674,21 @@ void SwHTMLParser::Continue( HtmlTokenId nToken )
EndNumBulList();
OSL_ENSURE( !m_nContextStMin, "There are protected contexts" );
- m_nContextStMin = 0;
- while( m_aContexts.size() )
+ // try this twice, first normally to let m_nContextStMin decrease
+ // naturally and get contexts popped in desired order, and if that
+ // fails force it
+ for (int i = 0; i < 2; ++i)
{
- std::unique_ptr<HTMLAttrContext> xCntxt(PopContext());
- if (xCntxt)
+ while (m_aContexts.size() > m_nContextStMin)
{
- EndContext(xCntxt.get());
+ std::unique_ptr<HTMLAttrContext> xCntxt(PopContext());
+ if (xCntxt)
+ EndContext(xCntxt.get());
}
+ if (!m_nContextStMin)
+ break;
+ OSL_ENSURE(!m_nContextStMin, "There are still protected contexts");
+ m_nContextStMin = 0;
}
if( !m_aParaAttrs.empty() )