Allocate the Cord element in the arena, instead of allocating on the heap and

then passing ownership to the arena.

PiperOrigin-RevId: 568551775
pull/14209/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 96100bf1e4
commit d5ec12e9a8
  1. 4
      src/google/protobuf/generated_message_tctable_lite.cc

@ -2270,10 +2270,8 @@ PROTOBUF_NOINLINE const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) {
absl::Cord* field;
if (is_oneof) {
if (need_init) {
field = new absl::Cord;
field = Arena::Create<absl::Cord>(msg->GetArenaForAllocation());
RefAt<absl::Cord*>(msg, entry.offset) = field;
Arena* arena = msg->GetArenaForAllocation();
if (arena) arena->Own(field);
} else {
field = RefAt<absl::Cord*>(msg, entry.offset);
}

Loading…
Cancel
Save