diff --git a/hphp/util/light_process.cpp b/hphp/util/light_process.cpp index 2d81dafb1..9c62e42a6 100644 --- a/hphp/util/light_process.cpp +++ b/hphp/util/light_process.cpp @@ -423,11 +423,15 @@ bool LightProcess::initShadow(const std::string &prefix, int id, } void LightProcess::Close() { - for (int i = 0; i < g_procsCount; i++) { - g_procs[i].closeShadow(); - } + boost::scoped_array procs; + procs.swap(g_procs); + int count = g_procsCount; g_procs.reset(); g_procsCount = 0; + + for (int i = 0; i < count; i++) { + procs[i].closeShadow(); + } } void LightProcess::closeShadow() {