diff --git a/tools/trace-malloc/lib/nsTraceMalloc.c b/tools/trace-malloc/lib/nsTraceMalloc.c index e3d9bf6ff84..c51faeba1fc 100644 --- a/tools/trace-malloc/lib/nsTraceMalloc.c +++ b/tools/trace-malloc/lib/nsTraceMalloc.c @@ -1712,7 +1712,8 @@ PR_IMPLEMENT(int) NS_TraceMallocStartupArgs(int argc, char* argv[]) } } - NS_TraceMallocStartup(logfd); + if (logfd >= 0) + NS_TraceMallocStartup(logfd); return argc; } diff --git a/xpcom/base/nsTraceMalloc.c b/xpcom/base/nsTraceMalloc.c index e3d9bf6ff84..c51faeba1fc 100644 --- a/xpcom/base/nsTraceMalloc.c +++ b/xpcom/base/nsTraceMalloc.c @@ -1712,7 +1712,8 @@ PR_IMPLEMENT(int) NS_TraceMallocStartupArgs(int argc, char* argv[]) } } - NS_TraceMallocStartup(logfd); + if (logfd >= 0) + NS_TraceMallocStartup(logfd); return argc; }