svtools/source/svrtf/parrtf.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit d8836d491a6fdf85d4b8df4952962fc6395f02c3 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 23 14:23:52 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 23 17:49:03 2021 +0200 ofz#35502 Indirect-leak Change-Id: Ib5bb8e39821cab4f398389971a6296885e2fa4bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117735 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index 8b5ad0a0a7cb..a11ec870cf4b 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -20,6 +20,8 @@ #include <sal/config.h> #include <sal/log.hxx> +#include <comphelper/scopeguard.hxx> + #include <rtl/character.hxx> #include <rtl/strbuf.hxx> #include <rtl/tencinfo.h> @@ -583,9 +585,12 @@ SvParserState SvRTFParser::CallParser() if( '{' == GetNextToken() && RTF_RTF == GetNextToken() ) { AddFirstRef(); + // call ReleaseRef at end of this scope, even in the face of exceptions + comphelper::ScopeGuard g([this] { + if( SvParserState::Pending != eState ) + ReleaseRef(); // now parser is not needed anymore + }); Continue( 0 ); - if( SvParserState::Pending != eState ) - ReleaseRef(); // now parser is not needed anymore } else eState = SvParserState::Error; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits