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

qianzhang pushed a commit to branch 1.4.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 1b6568f150013ab5def600cd1047017b5855d431
Author: Andrei Budnik <[email protected]>
AuthorDate: Fri Apr 5 13:06:49 2019 +0200

    Fixed use-after-free bug in Docker provisioner store.
    
    Deferred lambda callback of the `moveLayers()` to the `StoreProcess`
    to prevent use-after-free of the process object since the callback
    refers to the `StoreProcess` class variable `flags`.
    
    Review: https://reviews.apache.org/r/70405
---
 src/slave/containerizer/mesos/provisioner/docker/store.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/slave/containerizer/mesos/provisioner/docker/store.cpp 
b/src/slave/containerizer/mesos/provisioner/docker/store.cpp
index ba4db0a..89d1a88 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/store.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/store.cpp
@@ -390,7 +390,7 @@ Future<Image> StoreProcess::moveLayers(
   }
 
   return collect(futures)
-    .then([=]() -> Future<Image> {
+    .then(defer(self(), [=]() -> Future<Image> {
       if (image.has_config_digest()) {
         const string configSource = path::join(staging, image.config_digest());
         const string configTarget = paths::getImageLayerPath(
@@ -408,7 +408,7 @@ Future<Image> StoreProcess::moveLayers(
       }
 
       return image;
-    });
+    }));
 }
 
 

Reply via email to