From 37df4b65a473ce10843aa94e3fb5867e72d8df73 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Tue, 2 Jun 2015 22:26:00 -0700 Subject: [PATCH] Delete default UnknownFieldSet when shuting down. --- src/google/protobuf/unknown_field_set.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/google/protobuf/unknown_field_set.cc b/src/google/protobuf/unknown_field_set.cc index 766449003c..93f0f206ad 100644 --- a/src/google/protobuf/unknown_field_set.cc +++ b/src/google/protobuf/unknown_field_set.cc @@ -50,8 +50,13 @@ namespace { // instantiate the UnknownFieldSet dynamically only when required. UnknownFieldSet* default_unknown_field_set_instance_ = NULL; +void DeleteDefaultUnknownFieldSet() { + delete default_unknown_field_set_instance_; +} + void InitDefaultUnknownFieldSet() { default_unknown_field_set_instance_ = new UnknownFieldSet(); + internal::OnShutdown(&DeleteDefaultUnknownFieldSet); } GOOGLE_PROTOBUF_DECLARE_ONCE(default_unknown_field_set_once_init_);