purify fixes from bruce@cybersight.com - free memory the right way

This commit is contained in:
alecf%netscape.com 1999-03-10 00:32:44 +00:00
Родитель 9e73d8cb12
Коммит 770326593d
4 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -56,7 +56,7 @@ NS_IMPL_ISUPPORTS(ByteBufferImpl,kByteBufferIID)
ByteBufferImpl::~ByteBufferImpl()
{
if (nsnull != mBuffer) {
delete mBuffer;
delete[] mBuffer;
mBuffer = nsnull;
}
mLength = 0;
@ -87,7 +87,7 @@ PRBool ByteBufferImpl::Grow(PRUint32 aNewSize)
if (0 != mLength) {
nsCRT::memcpy(newbuf, mBuffer, mLength);
}
delete mBuffer;
delete[] mBuffer;
mBuffer = newbuf;
return PR_TRUE;
}

Просмотреть файл

@ -56,7 +56,7 @@ NS_IMPL_ISUPPORTS(UnicharBufferImpl,kUnicharBufferIID)
UnicharBufferImpl::~UnicharBufferImpl()
{
if (nsnull != mBuffer) {
delete mBuffer;
delete[] mBuffer;
mBuffer = nsnull;
}
mLength = 0;
@ -87,7 +87,7 @@ PRBool UnicharBufferImpl::Grow(PRInt32 aNewSize)
if (0 != mLength) {
nsCRT::memcpy(newbuf, mBuffer, mLength * sizeof(PRUnichar));
}
delete mBuffer;
delete[] mBuffer;
mBuffer = newbuf;
return PR_TRUE;
}

Просмотреть файл

@ -56,7 +56,7 @@ NS_IMPL_ISUPPORTS(ByteBufferImpl,kByteBufferIID)
ByteBufferImpl::~ByteBufferImpl()
{
if (nsnull != mBuffer) {
delete mBuffer;
delete[] mBuffer;
mBuffer = nsnull;
}
mLength = 0;
@ -87,7 +87,7 @@ PRBool ByteBufferImpl::Grow(PRUint32 aNewSize)
if (0 != mLength) {
nsCRT::memcpy(newbuf, mBuffer, mLength);
}
delete mBuffer;
delete[] mBuffer;
mBuffer = newbuf;
return PR_TRUE;
}

Просмотреть файл

@ -56,7 +56,7 @@ NS_IMPL_ISUPPORTS(UnicharBufferImpl,kUnicharBufferIID)
UnicharBufferImpl::~UnicharBufferImpl()
{
if (nsnull != mBuffer) {
delete mBuffer;
delete[] mBuffer;
mBuffer = nsnull;
}
mLength = 0;
@ -87,7 +87,7 @@ PRBool UnicharBufferImpl::Grow(PRInt32 aNewSize)
if (0 != mLength) {
nsCRT::memcpy(newbuf, mBuffer, mLength * sizeof(PRUnichar));
}
delete mBuffer;
delete[] mBuffer;
mBuffer = newbuf;
return PR_TRUE;
}