Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hello,

Scan coverity detected this:
27. overwrite_var: Overwriting "pMarg" in "pMarg = new SwMarginPortion(0)"
leaks the storage that "pMarg" points to

(http://opengrok.libreoffice.org/xref/core/sw/source/core/text/pormulti.cxx#738)
    738     if( nLeft || nRight )
    739     {
    740         if( !pCurr->GetPortion() )
    741             pCurr->SetPortion( new SwTxtPortion( *pCurr ) );
    742         SwMarginPortion *pMarg = new SwMarginPortion( 0 );
    743         if( nLeft )
    744         {
    745             pMarg->AddPrtWidth( nLeft );
    746             pMarg->SetPortion( pCurr->GetPortion() );
    747             pCurr->SetPortion( pMarg );
    748         }
    749         if( nRight )
    750         {
    751             pMarg = new SwMarginPortion( 0 );
    752             pMarg->AddPrtWidth( nRight );
    753             pCurr->FindLastPortion()->Append( pMarg );
    754         }
    755     }

I don't understand the line 751, shouldn't it simply removed or does it lack
something too?

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/About-coverity-705746-pormulti-cxx-from-sw-module-tp4043862.html
Sent from the Dev mailing list archive at Nabble.com.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.