summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
Diffstat (limited to 'net/base')
-rw-r--r--net/base/io_buffer.cc2
-rw-r--r--net/base/io_buffer.h4
2 files changed, 4 insertions, 2 deletions
diff --git a/net/base/io_buffer.cc b/net/base/io_buffer.cc
index c9b4532..c2401ab 100644
--- a/net/base/io_buffer.cc
+++ b/net/base/io_buffer.cc
@@ -9,7 +9,7 @@
namespace net {
IOBuffer::IOBuffer(int buffer_size) {
- DCHECK(buffer_size);
+ DCHECK(buffer_size > 0);
data_ = new char[buffer_size];
}
diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h
index 48d69d6..122e434 100644
--- a/net/base/io_buffer.h
+++ b/net/base/io_buffer.h
@@ -15,7 +15,6 @@ class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> {
public:
IOBuffer() : data_(NULL) {}
explicit IOBuffer(int buffer_size);
- explicit IOBuffer(char* data) : data_(data) {}
virtual ~IOBuffer() {
delete[] data_;
}
@@ -23,6 +22,9 @@ class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> {
char* data() { return data_; }
protected:
+ // Only allow derived classes to specify data_.
+ // In all other cases, we own data_, and must delete it at destruction time.
+ explicit IOBuffer(char* data) : data_(data) {}
char* data_;
};