Updated Branches: refs/heads/master 58955f9c9 -> 766bc68a6
Fixed a memory leak in os::read(). From: David Mackey <tdmac...@booleanhaiku.com> Review: https://reviews.apache.org/r/14336 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/766bc68a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/766bc68a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/766bc68a Branch: refs/heads/master Commit: 766bc68a6e57deddab635c3824c56d6a3a011c9c Parents: 58955f9 Author: Benjamin Mahler <bmah...@twitter.com> Authored: Wed Sep 25 14:58:31 2013 -0700 Committer: Benjamin Mahler <bmah...@twitter.com> Committed: Wed Sep 25 14:58:31 2013 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/766bc68a/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp index 0c5b2ef..587b7b9 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp +++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp @@ -33,17 +33,21 @@ inline Result<std::string> read(int fd, size_t size) } // Attempt to restore the original offset. lseek(fd, current, SEEK_SET); + delete[] buffer; return ErrnoError(); } else if (length == 0) { // Reached EOF before expected! Restore the offset. lseek(fd, current, SEEK_SET); + delete[] buffer; return None(); } offset += length; } - return std::string(buffer, size); + std::string result = std::string(buffer, size); + delete[] buffer; + return result; }