diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h index fb1b64a3e1..2b108616ad 100755 --- a/src/google/protobuf/arenastring.h +++ b/src/google/protobuf/arenastring.h @@ -322,10 +322,8 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { void CreateInstance(::google::protobuf::Arena* arena, const ::std::string* initial_value) { GOOGLE_DCHECK(initial_value != NULL); - ptr_ = new ::std::string(*initial_value); - if (arena != NULL) { - arena->Own(ptr_); - } + // uses "new ::std::string" when arena is nullptr + ptr_ = Arena::Create< ::std::string >(arena, *initial_value); } GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void CreateInstanceNoArena(const ::std::string* initial_value) {