On 01/13/18 05:37, Ranier VF wrote:
> Hi,
> Issue found by Coverity Scan.
> CID 210686 (#1 of 1): Resource leak (RESOURCE_LEAK)
>
> Best,
> Ranier.
> [...]
G'day,

Nice work on using Coverity to scan the code.

Note that gcc, from version 6 onwards, has a "-Wmisleading-indent"
warning, added as it might have helped stop the Apple "goto Fail;"
code from becoming a security hole.

Be aware that gcc 6 (I run 6.4.0 under Gentoo Linux), with this
warning enabled (typically via -Wall), would generate a diagnostic
for the following line:

+        if(d1) delete y1;      if(d2)  delete y2;

Attached is your patch, as inline text in the message body,
for your information.

cheers,

sur-behoffski (Brenton Hoff)
programmer, Grouse Software

======================
--- a\srcmglplot\src\plot.cpp   Sun Jun 19 15:01:20 2016
+++ b\srcmglplot\src\plot.cpp   Fri Jan 12 17:06:50 2018
@@ -212,7 +212,10 @@
        if(!y1) {       y1 = new mglData(n);    d1=true;        ((mglData 
*)y1)->Fill(NAN,NAN);      }
        if(!y2) {       y2 = new mglData(n);    d2=true;        ((mglData 
*)y2)->Fill(NAN,NAN);      }
        if(y1->GetNx()!=n || y2->GetNx()!=n)
-       {       gr->SetWarn(mglWarnDim,"Candle");  return; }
+       {       gr->SetWarn(mglWarnDim,"Candle");  
+        if(d1) delete y1;      if(d2)  delete y2;
+        return;
+       }
        static int cgid=1;      gr->StartGroup("Candle",cgid++);
        gr->SaveState(opt);  gr->SetPenPal(pen,&pal); gr->Reserve(8*n);
        bool sh = mglchr(pen,'!');

======================

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to