No public description PiperOrigin-RevId: 1014038232 Change-Id: I6fabbb40b139fa19804861ea1109f480e1514974
diff --git a/mpact/sim/decoder/BUILD b/mpact/sim/decoder/BUILD index c330b92..5ba48f8 100644 --- a/mpact/sim/decoder/BUILD +++ b/mpact/sim/decoder/BUILD
@@ -320,6 +320,7 @@ ":proto_format_lexer", ":proto_format_parser", "//mpact/sim/generic:type_helpers", + "@abseil-cpp//absl/cleanup", "@abseil-cpp//absl/container:btree", "@abseil-cpp//absl/container:flat_hash_map", "@abseil-cpp//absl/container:flat_hash_set",
diff --git a/mpact/sim/decoder/proto_format_visitor.cc b/mpact/sim/decoder/proto_format_visitor.cc index a2dbce5..8227759 100644 --- a/mpact/sim/decoder/proto_format_visitor.cc +++ b/mpact/sim/decoder/proto_format_visitor.cc
@@ -27,6 +27,7 @@ #include <string_view> #include <vector> +#include "absl/cleanup/cleanup.h" #include "absl/container/flat_hash_set.h" #include "absl/functional/bind_front.h" #include "absl/log/log.h" @@ -150,6 +151,9 @@ } descriptor_pool_ = importer.pool(); + absl::Cleanup cleanup_descriptor_pool = [this] { + descriptor_pool_ = nullptr; + }; // Set the finder function objects. field_finder_ = absl::bind_front( &google::protobuf::DescriptorPool::FindFieldByName, descriptor_pool_);
diff --git a/mpact/sim/decoder/proto_format_visitor.h b/mpact/sim/decoder/proto_format_visitor.h index c57730d..0d73ac0 100644 --- a/mpact/sim/decoder/proto_format_visitor.h +++ b/mpact/sim/decoder/proto_format_visitor.h
@@ -201,7 +201,7 @@ std::unique_ptr<decoder::DecoderErrorListener> error_listener_ = nullptr; std::string decoder_name_; // Descriptor pool. - const google::protobuf::DescriptorPool* descriptor_pool_; + const google::protobuf::DescriptorPool* descriptor_pool_ = nullptr; absl::flat_hash_map<std::string, const google::protobuf::FileDescriptor*> file_descriptor_map_; // Using decl map.