Fwd: [Libreoffice-commits] core.git: sal/qa
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon Jul 24 06:29:08 UTC 2017
New commits:
commit 0a38e49ee801be8e754cbf7b800aaab5da392c6d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 23 19:17:41 2017 +0100
coverity#1415617 Resource leak
Change-Id: Ib23bbd9403f44fd7aa3635a3febb6533b1f9edad
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index fcf227eb2541..a2f20058b36e 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -172,12 +172,12 @@ namespace osl_Pipe
void ctors_no_acquire( )
{
/// create a pipe.
- ::osl::Pipe* pPipe = new ::osl::Pipe(
test::uniquePipeName(aTestPipeName),
osl_Pipe_CREATE );
+ std::unique_ptr<osl::Pipe> xPipe(new
osl::Pipe(test::uniquePipeName(aTestPipeName),
osl_Pipe_CREATE));
/// constructs a pipe reference without acquiring the
handle.
- ::osl::Pipe* pNoAcquirePipe = new ::osl::Pipe(
pPipe->getHandle( ), SAL_NO_ACQUIRE );
+ std::unique_ptr<osl::Pipe> xNoAcquirePipe(new
osl::Pipe(xPipe->getHandle(), SAL_NO_ACQUIRE));
- StreamPipe aStreamPipe(pPipe->getHandle());
- delete pNoAcquirePipe;
+ StreamPipe aStreamPipe(xPipe->getHandle());
+ xNoAcquirePipe.reset();
int nRet = aStreamPipe.send("a", 1);
if (nRet >= 0)
I think this memory leak is actually required in this case. SAL_NO_ACQUIRE
means that the ref count of the internal pipe object is not incremented and
therefore during the destruction of the osl::Pipe we are now deleting the
same internal object twice.
I think this can be seen in
https://ci.libreoffice.org/job/lo_ubsan/611/consoleFull and IMHO the
easiest fix might be to just annotate that test for coverity. Maybe someone
has a better idea.
Regards,
Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170724/5039db9b/attachment.html>
More information about the LibreOffice
mailing list