diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 1e9728ac..93d3cbba 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -897,8 +897,8 @@ inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add() { return cast(elements_[current_size_++]); } if (allocated_size_ == total_size_) Reserve(total_size_ + 1); - ++allocated_size_; typename TypeHandler::Type* result = TypeHandler::New(); + ++allocated_size_; elements_[current_size_++] = result; return result; }