About coverity 705746 (pormulti.cxx from sw module)

julien2412 serval2412 at yahoo.fr
Thu Mar 14 12:20:48 PDT 2013


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.


More information about the LibreOffice mailing list