summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/dbase/DNoException.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/dbase/DNoException.cxx')
-rw-r--r--connectivity/source/drivers/dbase/DNoException.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/connectivity/source/drivers/dbase/DNoException.cxx b/connectivity/source/drivers/dbase/DNoException.cxx
index b130547e9265..357b2baad44a 100644
--- a/connectivity/source/drivers/dbase/DNoException.cxx
+++ b/connectivity/source/drivers/dbase/DNoException.cxx
@@ -225,7 +225,7 @@ void ODbaseTable::AllocBuffer()
}
// If no buffer available: allocate
- if (m_pBuffer == NULL && nSize)
+ if (m_pBuffer == NULL && nSize > 0)
{
m_nBufferSize = nSize;
m_pBuffer = new sal_uInt8[m_nBufferSize+1];
@@ -484,11 +484,14 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r
sal_uIntPtr nTell = rStream.Tell() % 512;
sal_uInt16 nBufferSize = rStream.GetBufferSize();
sal_uIntPtr nSize = nBufferSize - nTell;
- char* pEmptyData = new char[nSize];
- memset(pEmptyData,0x00,nSize);
- rStream.Write((sal_uInt8*)pEmptyData,nSize);
- rStream.Seek(nTell);
- delete [] pEmptyData;
+ if ( nSize <= nBufferSize )
+ {
+ char* pEmptyData = new char[nSize];
+ memset(pEmptyData,0x00,nSize);
+ rStream.Write((sal_uInt8*)pEmptyData,nSize);
+ rStream.Seek(nTell);
+ delete [] pEmptyData;
+ }
}
return rStream;
}