[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mesos-commits
Subject:    git commit: Fixed a memory leak in os::read().
From:       bmahler () apache ! org
Date:       2013-09-25 22:43:43
Message-ID: 48d173ef016441579e7bbc7d4b24c7fb () git ! apache ! org
[Download RAW message or body]

Updated Branches:
  refs/heads/master 58955f9c9 -> 766bc68a6


Fixed a memory leak in os::read().

From: David Mackey <tdmackey@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 <bmahler@twitter.com>
Authored: Wed Sep 25 14:58:31 2013 -0700
Committer: Benjamin Mahler <bmahler@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;
 }
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic