summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/salmisc.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-07-02 09:12:13 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-07-02 09:12:13 +0000
commitbdcd727221a7948a20dbc2cb831f44704f3e8598 (patch)
tree6891392eb0e616c4edf4bdb0a7be072bf99302e3 /vcl/source/gdi/salmisc.cxx
parent43bf2ad49c2b3989bbbe893e4fee2e032a3920f5 (diff)
INTEGRATION: CWS vcl90 (1.13.14); FILE MERGED
2008/06/03 14:50:50 pl 1.13.14.1: #i88744# catch more allocation problems
Diffstat (limited to 'vcl/source/gdi/salmisc.cxx')
-rw-r--r--vcl/source/gdi/salmisc.cxx30
1 files changed, 25 insertions, 5 deletions
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
index a57c4ad44f20..fc24c0289b50 100644
--- a/vcl/source/gdi/salmisc.cxx
+++ b/vcl/source/gdi/salmisc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salmisc.cxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
* This file is part of OpenOffice.org.
*
@@ -408,12 +408,32 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec
const long nSrcX = rTwoRect.mnSrcX, nSrcY = rTwoRect.mnSrcY;
const long nSrcDX = rTwoRect.mnSrcWidth, nSrcDY = rTwoRect.mnSrcHeight;
const long nDstDX = rTwoRect.mnDestWidth, nDstDY = rTwoRect.mnDestHeight;
- Scanline* pSrcScan = new Scanline[ rSrcBuffer.mnHeight ];
- Scanline* pDstScan = new Scanline[ nDstDY ];
- long* pMapX = new long[ nDstDX ];
- long* pMapY = new long[ nDstDY ];
+ Scanline* pSrcScan = NULL;
+ Scanline* pDstScan = NULL;
+ long* pMapX = NULL;
+ long* pMapY = NULL;
long nTmp, nOffset;
+ try
+ {
+ pSrcScan = new Scanline[ rSrcBuffer.mnHeight ];
+ pDstScan = new Scanline[ nDstDY ];
+ pMapX = new long[ nDstDX ];
+ pMapY = new long[ nDstDY ];
+ }
+ catch( const std::bad_alloc& )
+ {
+ // memory exception, clean up
+ // remark: the buffer ptr causing the exception
+ // is still NULL here
+ delete pSrcScan;
+ delete pDstScan;
+ delete pMapX;
+ delete pMapY;
+ delete pDstBuffer;
+ return NULL;
+ }
+
// horizontal mapping table
if( nDstDX != nSrcDX )
{