зеркало из https://github.com/mozilla/gecko-dev.git
coverity-found potential use-after-free in testcases (bug 334541). r=bsmedberg
This commit is contained in:
Родитель
c65cea94eb
Коммит
369c3dbf2e
|
@ -155,24 +155,21 @@ IFoo::AddRef()
|
||||||
nsrefcnt
|
nsrefcnt
|
||||||
IFoo::Release()
|
IFoo::Release()
|
||||||
{
|
{
|
||||||
int wrap_message = (refcount_ == 1);
|
int newcount = --refcount_;
|
||||||
if ( wrap_message )
|
if ( newcount == 0 )
|
||||||
printf(">>");
|
printf(">>");
|
||||||
|
|
||||||
--refcount_;
|
|
||||||
printf("IFoo@%p::Release(), refcount --> %d\n",
|
printf("IFoo@%p::Release(), refcount --> %d\n",
|
||||||
STATIC_CAST(void*, this), refcount_);
|
STATIC_CAST(void*, this), refcount_);
|
||||||
|
|
||||||
if ( !refcount_ )
|
if ( newcount == 0 )
|
||||||
{
|
{
|
||||||
printf(" delete IFoo@%p\n", STATIC_CAST(void*, this));
|
printf(" delete IFoo@%p\n", STATIC_CAST(void*, this));
|
||||||
|
printf("<<IFoo@%p::Release()\n", STATIC_CAST(void*, this));
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( wrap_message )
|
return newcount;
|
||||||
printf("<<IFoo@%p::Release()\n", STATIC_CAST(void*, this));
|
|
||||||
|
|
||||||
return refcount_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -288,24 +288,21 @@ IFoo::AddRef()
|
||||||
nsrefcnt
|
nsrefcnt
|
||||||
IFoo::Release()
|
IFoo::Release()
|
||||||
{
|
{
|
||||||
int wrap_message = (refcount_ == 1);
|
int newcount = --refcount_;
|
||||||
if ( wrap_message )
|
if ( newcount == 0 )
|
||||||
printf(">>");
|
printf(">>");
|
||||||
|
|
||||||
--refcount_;
|
|
||||||
printf("IFoo@%p::Release(), refcount --> %d\n",
|
printf("IFoo@%p::Release(), refcount --> %d\n",
|
||||||
NS_STATIC_CAST(void*, this), refcount_);
|
NS_STATIC_CAST(void*, this), refcount_);
|
||||||
|
|
||||||
if ( !refcount_ )
|
if ( newcount == 0 )
|
||||||
{
|
{
|
||||||
printf(" delete IFoo@%p\n", NS_STATIC_CAST(void*, this));
|
printf(" delete IFoo@%p\n", NS_STATIC_CAST(void*, this));
|
||||||
|
printf("<<IFoo@%p::Release()\n", NS_STATIC_CAST(void*, this));
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( wrap_message )
|
return newcount;
|
||||||
printf(" delete IFoo@%p\n", NS_STATIC_CAST(void*, this));
|
|
||||||
|
|
||||||
return refcount_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
Загрузка…
Ссылка в новой задаче