Commit 67c19dd9 authored by sbc's avatar sbc Committed by Commit bot

[NaCl SDK] nacl_io: Fix gaping memory leaks in memfs and htmlfs

I introduced these leaks recently and really should
have run valgrind.  In future out valgrind bot should
find such things pre-submit.

Review URL: https://codereview.chromium.org/605433003

Cr-Commit-Position: refs/heads/master@{#296606}
parent c76aa4c9
...@@ -236,6 +236,10 @@ HttpFsNode::HttpFsNode(Filesystem* filesystem, ...@@ -236,6 +236,10 @@ HttpFsNode::HttpFsNode(Filesystem* filesystem,
SetMode(S_IRALL); SetMode(S_IRALL);
} }
HttpFsNode::~HttpFsNode() {
free(buffer_);
}
Error HttpFsNode::GetStat_Locked(struct stat* stat) { Error HttpFsNode::GetStat_Locked(struct stat* stat) {
// Assume we need to 'HEAD' if we do not know the size, otherwise, assume // Assume we need to 'HEAD' if we do not know the size, otherwise, assume
// that the information is constant. We can add a timeout if needed. // that the information is constant. We can add a timeout if needed.
......
...@@ -43,6 +43,8 @@ class HttpFsNode : public Node { ...@@ -43,6 +43,8 @@ class HttpFsNode : public Node {
const std::string& url, const std::string& url,
bool cache_content); bool cache_content);
virtual ~HttpFsNode();
private: private:
Error GetStat_Locked(struct stat* stat); Error GetStat_Locked(struct stat* stat);
Error OpenUrl(const char* method, Error OpenUrl(const char* method,
......
...@@ -37,6 +37,7 @@ MemFsNode::MemFsNode(Filesystem* filesystem) ...@@ -37,6 +37,7 @@ MemFsNode::MemFsNode(Filesystem* filesystem)
} }
MemFsNode::~MemFsNode() { MemFsNode::~MemFsNode() {
free(data_);
} }
Error MemFsNode::Read(const HandleAttr& attr, Error MemFsNode::Read(const HandleAttr& attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment