summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-06 00:05:44 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-06 00:05:44 +0000
commit8ec3ace59651a1febdc76c162529be1c2bf9ad3d (patch)
treeb76e45ec4fca044fa4ca46e11dc0735f81c15c1e
parent41dc49d6bcb58c3605f0a9fc9e05c8d4616b10f6 (diff)
downloadchromium_src-8ec3ace59651a1febdc76c162529be1c2bf9ad3d.zip
chromium_src-8ec3ace59651a1febdc76c162529be1c2bf9ad3d.tar.gz
chromium_src-8ec3ace59651a1febdc76c162529be1c2bf9ad3d.tar.bz2
Fix a memory leak on the async resource handler.
BUG=7374 Review URL: http://codereview.chromium.org/20099 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9284 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/async_resource_handler.cc2
-rw-r--r--net/base/io_buffer.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/async_resource_handler.cc b/chrome/browser/renderer_host/async_resource_handler.cc
index b99fa23..687946e 100644
--- a/chrome/browser/renderer_host/async_resource_handler.cc
+++ b/chrome/browser/renderer_host/async_resource_handler.cc
@@ -14,7 +14,7 @@ SharedIOBuffer* AsyncResourceHandler::spare_read_buffer_;
// Our version of IOBuffer that uses shared memory.
class SharedIOBuffer : public net::IOBuffer {
public:
- SharedIOBuffer(int buffer_size) : net::IOBuffer(NULL), ok_(false) {
+ SharedIOBuffer(int buffer_size) : net::IOBuffer(), ok_(false) {
if (shared_memory_.Create(std::wstring(), false, false, buffer_size) &&
shared_memory_.Map(buffer_size)) {
ok_ = true;
diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h
index b390103..39399ad 100644
--- a/net/base/io_buffer.h
+++ b/net/base/io_buffer.h
@@ -5,6 +5,7 @@
#ifndef NET_BASE_IO_BUFFER_H_
#define NET_BASE_IO_BUFFER_H_
+#include "base/logging.h"
#include "base/ref_counted.h"
namespace net {
@@ -13,7 +14,9 @@ namespace net {
// easier asynchronous IO handling.
class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> {
public:
+ IOBuffer() : data_(NULL) {}
explicit IOBuffer(int buffer_size) {
+ DCHECK(buffer_size);
data_ = new char[buffer_size];
}
explicit IOBuffer(char* buffer) : data_(buffer) {}