This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b40bfd  Fixed a potential use after free bug.
3b40bfd is described below

commit 3b40bfdd955bfbb0965aac52b9cd8353ec679b1b
Author: Benjamin Bannier <[email protected]>
AuthorDate: Mon Jan 27 15:33:09 2020 +0100

    Fixed a potential use after free bug.
    
    Moving a framework to `frameworks.completed` transfers ownership of the
    Framework to that container and e.g., using the original framework
    pointer after that could fail (the framework could e.g., be already be
    rotated out).
    
    This patch fixes the master to not use the potentially cleaned up
    framework pointer anymore.
    
    Review: https://reviews.apache.org/r/71781/
---
 src/master/master.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/master/master.cpp b/src/master/master.cpp
index d802b3e..d41ae72 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -10957,12 +10957,14 @@ void Master::removeFramework(Framework* framework)
 
   allocator->resume();
 
+  const FrameworkInfo frameworkInfo = framework->info;
+
   // The framework pointer is now owned by `frameworks.completed`.
   frameworks.completed.set(framework->id(), Owned<Framework>(framework));
 
   if (!subscribers.subscribed.empty()) {
     subscribers.send(
-        protobuf::master::event::createFrameworkRemoved(framework->info));
+        protobuf::master::event::createFrameworkRemoved(frameworkInfo));
   }
 }
 

Reply via email to