You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/04/25 23:15:30 UTC

[14/24] mesos git commit: Fixed a memory leak in process::subprocess.

Fixed a memory leak in process::subprocess.

Review: https://reviews.apache.org/r/45267


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e6d839ba
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e6d839ba
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e6d839ba

Branch: refs/heads/0.28.x
Commit: e6d839baed7f9ea4ef7053bce228599d6b2f05ac
Parents: e9f7426
Author: Benjamin Mahler <bm...@apache.org>
Authored: Wed Mar 23 20:30:32 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Apr 5 15:14:47 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/subprocess.cpp | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e6d839ba/3rdparty/libprocess/src/subprocess.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/subprocess.cpp b/3rdparty/libprocess/src/subprocess.cpp
index 16c327d..bca9521 100644
--- a/3rdparty/libprocess/src/subprocess.cpp
+++ b/3rdparty/libprocess/src/subprocess.cpp
@@ -452,6 +452,12 @@ Try<Subprocess> subprocess(
   // us and we needed to allocate the space.
   if (environment.isSome()) {
     CHECK_NE(os::raw::environment(), envp);
+
+    // We ignore the last 'envp' entry since it is NULL.
+    for (size_t index = 0; index < environment->size(); index++) {
+      delete[] envp[index];
+    }
+
     delete[] envp;
   }