зеркало из https://github.com/mozilla/pjs.git
purify fixes from bruce@cybersight.com - free memory the right way
This commit is contained in:
Родитель
9e73d8cb12
Коммит
770326593d
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче