Bug 1019913 - If gBloatView fails, call |maybeUnregisterAndCloseFile()| on gBloatLog instead of setting it to NULL. r=nfroyd

This commit is contained in:
Shashank Sabniveesu 2014-07-07 16:10:00 +02:00
parent 49c8453a1e
commit 732ff5129e

View File

@ -715,6 +715,19 @@ HashNumber(const void* aKey)
return PLHashNumber(NS_PTR_TO_INT32(aKey));
}
static void
maybeUnregisterAndCloseFile(FILE*& aFile)
{
if (!aFile) {
return;
}
MozillaUnRegisterDebugFILE(aFile);
fclose(aFile);
aFile = nullptr;
}
static void
InitTraceLog()
{
@ -731,7 +744,7 @@ InitTraceLog()
RecreateBloatView();
if (!gBloatView) {
NS_WARNING("out of memory");
gBloatLog = nullptr;
maybeUnregisterAndCloseFile(gBloatLog);
gLogLeaksOnly = false;
}
}
@ -1272,18 +1285,6 @@ nsTraceRefcnt::Startup()
{
}
static void
maybeUnregisterAndCloseFile(FILE*& aFile)
{
if (!aFile) {
return;
}
MozillaUnRegisterDebugFILE(aFile);
fclose(aFile);
aFile = nullptr;
}
void
nsTraceRefcnt::Shutdown()
{