fix use-after-free in addFunctionOnce
[folly.git] / folly / experimental / FunctionScheduler.cpp
index 6dfb2c2c76f0b9a53c536f749020b8377652336e..83fba55b1627cfdfc48da881cb929f90b0ab1a68 100644 (file)
@@ -445,6 +445,7 @@ void FunctionScheduler::runOneFunction(std::unique_lock<std::mutex>& lock,
   }
   if (currentFunction_->runOnce) {
     // Don't reschedule if the function only needed to run once.
+    currentFunction_ = nullptr;
     return;
   }
   // Clear currentFunction_