summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-01-21 09:28:12 +0000
committerDavid Tardon <dtardon@redhat.com>2016-01-25 09:28:18 +0000
commit636d45438f317d7ef39d660c11f6bab1dc42302a (patch)
tree64782fd53db96ea7504ef105e4e90fa84fe48500 /vcl
parent85918431993fe3637145cca62b133c0c21cb5430 (diff)
valgrind: memleak on thrown exception
(cherry picked from commit f5aefab2a62a90c631e05ec29022a2f7e19f00c3) Change-Id: I2788c5fe04a984d6534adbd3186cc652685152e8 Reviewed-on: https://gerrit.libreoffice.org/21737 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/wmf/enhwmf.cxx6
-rw-r--r--vcl/source/filter/wmf/winmtf.cxx10
-rw-r--r--vcl/source/filter/wmf/winmtf.hxx2
-rw-r--r--vcl/source/filter/wmf/winwmf.cxx4
4 files changed, 10 insertions, 12 deletions
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index a59d6847ec24..f130fad1fd98 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -1239,7 +1239,7 @@ bool EnhWMFReader::ReadEnhWMF()
Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) );
aBitmap.Crop( aCropRect );
}
- aBmpSaveList.push_back( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ) );
+ aBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aRect, dwRop, pOut->GetFillStyle ()));
}
}
}
@@ -1303,7 +1303,7 @@ bool EnhWMFReader::ReadEnhWMF()
Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) );
aBitmap.Crop( aCropRect );
}
- aBmpSaveList.push_back( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ) );
+ aBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aRect, dwRop, pOut->GetFillStyle ()));
}
}
}
@@ -1373,7 +1373,7 @@ bool EnhWMFReader::ReadEnhWMF()
Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) );
aBitmap.Crop( aCropRect );
}
- aBmpSaveList.push_back( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ) );
+ aBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aRect, dwRop, pOut->GetFillStyle ()));
}
}
}
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 513751d0a75b..b2ae7dc65376 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -1577,7 +1577,7 @@ void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList )
size_t nObjectsOfSameSize = 0;
size_t nObjectStartIndex = nObjects - nObjectsLeft;
- BSaveStruct* pSave = rSaveList[ nObjectStartIndex ];
+ BSaveStruct* pSave = rSaveList[nObjectStartIndex].get();
Rectangle aRect( pSave->aOutRect );
for ( i = nObjectStartIndex; i < nObjects; )
@@ -1585,7 +1585,7 @@ void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList )
nObjectsOfSameSize++;
if ( ++i < nObjects )
{
- pSave = rSaveList[ i ];
+ pSave = rSaveList[i].get();
if ( pSave->aOutRect != aRect )
break;
}
@@ -1595,7 +1595,7 @@ void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList )
for ( i = nObjectStartIndex; i < ( nObjectStartIndex + nObjectsOfSameSize ); i++ )
{
- pSave = rSaveList[ i ];
+ pSave = rSaveList[i].get();
sal_uInt32 nWinRop = pSave->nWinRop;
sal_uInt8 nRasterOperation = (sal_uInt8)( nWinRop >> 16 );
@@ -1623,7 +1623,7 @@ void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList )
{
if ( nObjectsOfSameSize == 2 )
{
- BSaveStruct* pSave2 = rSaveList[ i + 1 ];
+ BSaveStruct* pSave2 = rSaveList[i + 1].get();
if ( ( pSave->aBmp.GetPrefSize() == pSave2->aBmp.GetPrefSize() ) &&
( pSave->aBmp.GetPrefMapMode() == pSave2->aBmp.GetPrefMapMode() ) )
{
@@ -1792,8 +1792,6 @@ void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList )
nObjectsLeft -= nObjectsOfSameSize;
}
- for( size_t i = 0, n = rSaveList.size(); i < n; ++i )
- delete rSaveList[ i ];
rSaveList.clear();
}
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index 3b78821bad43..dd355619a1ad 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -471,7 +471,7 @@ struct BSaveStruct
{}
};
-typedef ::std::vector< BSaveStruct* > BSaveStructList_impl;
+typedef std::vector<std::unique_ptr<BSaveStruct>> BSaveStructList_impl;
enum GDIObjectType
{
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 1f4cd7d383ed..04e553596fed 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -676,7 +676,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
aBmp.Crop( aCropRect );
}
Rectangle aDestRect( aPoint, Size( nSxe, nSye ) );
- aBmpSaveList.push_back( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ) );
+ aBmpSaveList.emplace_back(new BSaveStruct(aBmp, aDestRect, nWinROP, pOut->GetFillStyle ()));
}
}
}
@@ -726,7 +726,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
Rectangle aCropRect( Point( nSx, nSy ), Size( nSxe, nSye ) );
aBmp.Crop( aCropRect );
}
- aBmpSaveList.push_back( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ) );
+ aBmpSaveList.emplace_back(new BSaveStruct(aBmp, aDestRect, nWinROP, pOut->GetFillStyle ()));
}
}
}