coverity-found potential use-after-free in testcases (bug 334541). r=bsmedberg

This commit is contained in:
dveditz%cruzio.com 2007-01-26 02:50:18 +00:00
Родитель 6aaad025ce
Коммит c253c7e3aa
2 изменённых файлов: 12 добавлений и 18 удалений

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

@ -155,24 +155,21 @@ IFoo::AddRef()
nsrefcnt
IFoo::Release()
{
int wrap_message = (refcount_ == 1);
if ( wrap_message )
int newcount = --refcount_;
if ( newcount == 0 )
printf(">>");
--refcount_;
printf("IFoo@%p::Release(), refcount --> %d\n",
STATIC_CAST(void*, this), refcount_);
if ( !refcount_ )
if ( newcount == 0 )
{
printf(" delete IFoo@%p\n", STATIC_CAST(void*, this));
printf("<<IFoo@%p::Release()\n", STATIC_CAST(void*, this));
delete this;
}
if ( wrap_message )
printf("<<IFoo@%p::Release()\n", STATIC_CAST(void*, this));
return refcount_;
return newcount;
}
nsresult

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

@ -288,24 +288,21 @@ IFoo::AddRef()
nsrefcnt
IFoo::Release()
{
int wrap_message = (refcount_ == 1);
if ( wrap_message )
int newcount = --refcount_;
if ( newcount == 0 )
printf(">>");
--refcount_;
printf("IFoo@%p::Release(), refcount --> %d\n",
NS_STATIC_CAST(void*, this), refcount_);
if ( !refcount_ )
if ( newcount == 0 )
{
printf(" delete IFoo@%p\n", NS_STATIC_CAST(void*, this));
printf("<<IFoo@%p::Release()\n", NS_STATIC_CAST(void*, this));
delete this;
}
if ( wrap_message )
printf(" delete IFoo@%p\n", NS_STATIC_CAST(void*, this));
return refcount_;
return newcount;
}
nsresult