summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/pickle.cc9
-rw-r--r--base/pickle.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/base/pickle.cc b/base/pickle.cc
index 31bf5b7..0be89c2 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -65,6 +65,10 @@ Pickle::~Pickle() {
}
Pickle& Pickle::operator=(const Pickle& other) {
+ if (this == &other) {
+ NOTREACHED();
+ return *this;
+ }
if (capacity_ == kCapacityReadOnly) {
header_ = NULL;
capacity_ = 0;
@@ -74,9 +78,10 @@ Pickle& Pickle::operator=(const Pickle& other) {
header_ = NULL;
header_size_ = other.header_size_;
}
- bool resized = Resize(header_size_ + other.header_->payload_size);
+ bool resized = Resize(other.header_size_ + other.header_->payload_size);
CHECK(resized); // Realloc failed.
- memcpy(header_, other.header_, header_size_ + other.header_->payload_size);
+ memcpy(header_, other.header_,
+ other.header_size_ + other.header_->payload_size);
variable_buffer_offset_ = other.variable_buffer_offset_;
return *this;
}
diff --git a/base/pickle.h b/base/pickle.h
index 5b70729..9760483 100644
--- a/base/pickle.h
+++ b/base/pickle.h
@@ -31,7 +31,7 @@
//
class Pickle {
public:
- ~Pickle();
+ virtual ~Pickle();
// Initialize a Pickle object using the default header size.
Pickle();