<div dir="ltr"><div><div><div><div><br><div class="gmail_quote">
New commits:<br>
commit 0a38e49ee801be8e754cbf7b800aaa<wbr>b5da392c6d<br>
Author: Caolán McNamara <<a href="mailto:caolanm@redhat.com">caolanm@redhat.com</a>><br>
Date: Sun Jul 23 19:17:41 2017 +0100<br>
<br>
coverity#1415617 Resource leak<br>
<br>
Change-Id: Ib23bbd9403f44fd7aa3635a3febb6<wbr>533b1f9edad<br>
<br>
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx<br>
index fcf227eb2541..a2f20058b36e 100644<br>
--- a/sal/qa/osl/pipe/osl_Pipe.cxx<br>
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx<br>
@@ -172,12 +172,12 @@ namespace osl_Pipe<br>
void ctors_no_acquire( )<br>
{<br>
/// create a pipe.<br>
- ::osl::Pipe* pPipe = new ::osl::Pipe( test::uniquePipeName(<wbr>aTestPipeName), osl_Pipe_CREATE );<br>
+ std::unique_ptr<osl::Pipe> xPipe(new osl::Pipe(test::<wbr>uniquePipeName(aTestPipeName), osl_Pipe_CREATE));<br>
/// constructs a pipe reference without acquiring the handle.<br>
- ::osl::Pipe* pNoAcquirePipe = new ::osl::Pipe( pPipe->getHandle( ), SAL_NO_ACQUIRE );<br>
+ std::unique_ptr<osl::Pipe> xNoAcquirePipe(new osl::Pipe(xPipe->getHandle(), SAL_NO_ACQUIRE));<br>
<br>
- StreamPipe aStreamPipe(pPipe->getHandle()<wbr>);<br>
- delete pNoAcquirePipe;<br>
+ StreamPipe aStreamPipe(xPipe->getHandle()<wbr>);<br>
+ xNoAcquirePipe.reset();<br>
int nRet = aStreamPipe.send("a", 1);<br>
<br>
if (nRet >= 0)<br>
<br></div><br><br></div>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.<br><br></div>I think this can be seen in <a href="https://ci.libreoffice.org/job/lo_ubsan/611/consoleFull">https://ci.libreoffice.org/job/lo_ubsan/611/consoleFull</a> and IMHO the easiest fix might be to just annotate that test for coverity. Maybe someone has a better idea.<br><br></div>Regards,<br></div>Markus<br></div>