Internal change PiperOrigin-RevId: 967359668
diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc index c0b3198..72e162d 100644 --- a/src/google/protobuf/dynamic_message.cc +++ b/src/google/protobuf/dynamic_message.cc
@@ -823,7 +823,8 @@ DynamicMessageFactory::GetPrototype(const Descriptor* PROTOBUF_NONNULL type) { ABSL_CHECK(type != nullptr); absl::MutexLock lock(&prototypes_mutex_); - return GetPrototypeNoLock(type); + auto* result = GetPrototypeNoLock(type); + return result; } const Message* DynamicMessageFactory::GetPrototypeNoLock( @@ -835,6 +836,7 @@ // Otherwise, we will create it dynamically so keep going. } + const TypeInfo** target = &prototypes_[type]; if (*target != nullptr) { // Already exists.