Commit f5bf5ba2 authored by davidben@chromium.org's avatar davidben@chromium.org

Fix IOBuffer leak in CertificateResourceHandler and StreamResourceHandler.

As found in https://crbug.com/361440#c9.

BUG=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263047 0039d316-1c4b-4281-b951-d872f2087c98
parent bda6438c
...@@ -91,8 +91,8 @@ bool CertificateResourceHandler::OnReadCompleted(int request_id, ...@@ -91,8 +91,8 @@ bool CertificateResourceHandler::OnReadCompleted(int request_id,
// Release the ownership of the buffer, and store a reference // Release the ownership of the buffer, and store a reference
// to it. A new one will be allocated in OnWillRead(). // to it. A new one will be allocated in OnWillRead().
net::IOBuffer* buffer = NULL; scoped_refptr<net::IOBuffer> buffer;
read_buffer_.swap(&buffer); read_buffer_.swap(buffer);
// TODO(gauravsh): Should this be handled by a separate thread? // TODO(gauravsh): Should this be handled by a separate thread?
buffer_.push_back(std::make_pair(buffer, bytes_read)); buffer_.push_back(std::make_pair(buffer, bytes_read));
......
...@@ -88,8 +88,8 @@ bool StreamResourceHandler::OnReadCompleted(int request_id, ...@@ -88,8 +88,8 @@ bool StreamResourceHandler::OnReadCompleted(int request_id,
// Release the ownership of the buffer, and store a reference // Release the ownership of the buffer, and store a reference
// to it. A new one will be allocated in OnWillRead(). // to it. A new one will be allocated in OnWillRead().
net::IOBuffer* buffer = NULL; scoped_refptr<net::IOBuffer> buffer;
read_buffer_.swap(&buffer); read_buffer_.swap(buffer);
stream_->AddData(buffer, bytes_read); stream_->AddData(buffer, bytes_read);
if (!stream_->can_add_data()) if (!stream_->can_add_data())
......
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