diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-07-15 12:52:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-07-15 15:57:23 +0200 |
commit | 48d2013ff913fdd9552b81cbe8474211c1c90e50 (patch) | |
tree | 7677cae00b31b1a0f5a55da6bf77c8b5f624d58d /sw | |
parent | c96707fa8d3a81e0c2f425db2029f65b3481aa27 (diff) |
ofz#15731 Direct-leak RedlineExtraData is copied
Change-Id: I363c91125ecc78e746865cf1fba5913730e0d8e7
Reviewed-on: https://gerrit.libreoffice.org/75633
Tested-by: Jenkins
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/core/unocore/unocrsrhelper.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 27427c5a3bea..84f20f7a3a60 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1201,7 +1201,7 @@ void makeRedline( SwPaM const & rPaM, aRedlineData.SetTimeStamp( DateTime( aStamp)); } - SwRedlineExtraData_FormatColl * pRedlineExtraData = nullptr; + std::unique_ptr<SwRedlineExtraData_FormatColl> xRedlineExtraData; // Read the 'Redline Revert Properties' from the parameters uno::Sequence< beans::PropertyValue > aRevertProperties; @@ -1216,7 +1216,7 @@ void makeRedline( SwPaM const & rPaM, if (!aRevertProperties.hasElements()) { // to reject the paragraph style change, use standard style - pRedlineExtraData = new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ); + xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr )); } } else @@ -1303,10 +1303,10 @@ void makeRedline( SwPaM const & rPaM, if (eType == RedlineType::ParagraphFormat && sParaStyleName.isEmpty()) nStylePoolId = RES_POOLCOLL_STANDARD; - pRedlineExtraData = new SwRedlineExtraData_FormatColl( sParaStyleName, nStylePoolId, &aItemSet ); + xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( sParaStyleName, nStylePoolId, &aItemSet )); } else if (eType == RedlineType::ParagraphFormat) - pRedlineExtraData = new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ); + xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr )); } // to finalize DOCX import @@ -1316,7 +1316,8 @@ void makeRedline( SwPaM const & rPaM, SwRangeRedline* pRedline = new SwRangeRedline( aRedlineData, rPaM ); RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( ); - pRedline->SetExtraData( pRedlineExtraData ); + // xRedlineExtraData is copied here + pRedline->SetExtraData( xRedlineExtraData.get() ); pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On); auto const result(pRedlineAccess->AppendRedline(pRedline, false)); |