From bb209f2f53edc1b0d268d561e0c12bf93e83fb41 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 11 Sep 2018 09:42:35 +0200 Subject: Revert "clang bugprone-unused-return-value" comment from sberg: aren't these changes broken in general, when the called function may throw an exception before it takes ownership of the passed-in pointer? So revert, except for (a) PlainTextFilterDetect::detect, which was definitely a leak (b) SwCursor::FindAll, where unique_ptr was being unnecessarily used This reverts commit 7764ae70b04058a64a3999529e98d1115ba59d1c. Change-Id: I555e651b44e245b031729013d2ce88d26e8a357e Reviewed-on: https://gerrit.libreoffice.org/60301 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- package/source/zippackage/ZipPackageStream.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'package') diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 5e62b8bf1aff..5fe4d0ef80c5 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -727,9 +727,10 @@ bool ZipPackageStream::saveChild( if ( m_bRawStream ) xStream->skipBytes( m_nMagicalHackPos ); - // the entry is provided to the ZipOutputStream that will delete it - ZipOutputStream::setEntry(pAutoTempEntry.release()); + ZipOutputStream::setEntry(pTempEntry); rZipOut.writeLOC(pTempEntry); + // the entry is provided to the ZipOutputStream that will delete it + pAutoTempEntry.release(); uno::Sequence < sal_Int8 > aSeq ( n_ConstBufferSize ); sal_Int32 nLength; @@ -796,8 +797,9 @@ bool ZipPackageStream::saveChild( try { + ZipOutputStream::setEntry(pTempEntry); // the entry is provided to the ZipOutputStream that will delete it - ZipOutputStream::setEntry(pAutoTempEntry.release()); + pAutoTempEntry.release(); if (pTempEntry->nMethod == STORED) { -- cgit