diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-09-06 20:09:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-09-07 16:46:57 +0200 |
commit | 86b55d24940b476162c1a9d218082fbe9a0bf1e1 (patch) | |
tree | 75943b0ac5e2f7c97fd8e0aa8760c40166c5aa00 /filter/source | |
parent | c24fe44064c6624fefe642508086c8562c372fba (diff) |
cid#1500419 rearrange to silence Use after free
Change-Id: I4529306d94c88ba6572f108f512f1521c849246c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139536
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 3044762de92a..9c754b236988 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -4867,7 +4867,6 @@ public: EscherEx::EscherEx(std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, bool bOOXML) : mxGlobal(std::move(xGlobal)) , mpOutStrm(pOutStrm) - , mbOwnsStrm(false) , mnCurrentDg(0) , mnCountOfs(0) , mnGroupLevel(0) @@ -4878,8 +4877,8 @@ EscherEx::EscherEx(std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, { if (!mpOutStrm) { - mpOutStrm = new SvNullStream(); - mbOwnsStrm = true; + mxOwnStrm = std::make_unique<SvNullStream>(); + mpOutStrm = mxOwnStrm.get(); } mnStrmStartOfs = mpOutStrm->Tell(); mpImplEESdrWriter.reset( new ImplEESdrWriter( *this ) ); @@ -4887,8 +4886,6 @@ EscherEx::EscherEx(std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, EscherEx::~EscherEx() { - if (mbOwnsStrm) - delete mpOutStrm; } void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ ) |