diff --git a/src/ScriptProfile.cc b/src/ScriptProfile.cc index 198d6cd268..a08071e5be 100644 --- a/src/ScriptProfile.cc +++ b/src/ScriptProfile.cc @@ -117,6 +117,9 @@ ScriptProfileMgr::~ScriptProfileMgr() fprintf(f, "non-scripts\t\tTOTAL\t%d\t%.06f\t%.06f\t%lld\t%lld\n", non_scripts.NumCalls(), non_scripts.CPUTime(), 0.0, non_scripts.Memory(), 0LL); + + if ( f != stdout ) + fclose(f); } void ScriptProfileMgr::StartInvocation(const Func* f, const detail::StmtPtr& body)