diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2014-10-08 17:28:03 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2014-10-08 17:28:03 -0700 |
commit | 06e6690bf2055b4361db2a6bdd21facf3f2d86d6 (patch) | |
tree | 476ad845dfb6f4e0f5037db051281d7195d9d856 | |
parent | 0971bb0d57aa6f2db1abee4008b365d52b402891 (diff) | |
download | protobuf-06e6690bf2055b4361db2a6bdd21facf3f2d86d6.tar.gz protobuf-06e6690bf2055b4361db2a6bdd21facf3f2d86d6.tar.bz2 protobuf-06e6690bf2055b4361db2a6bdd21facf3f2d86d6.zip |
Fix the memory leak of GetEmptyString().
-rw-r--r-- | src/google/protobuf/generated_message_util.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc index c30c07ca..0c20d81c 100644 --- a/src/google/protobuf/generated_message_util.cc +++ b/src/google/protobuf/generated_message_util.cc @@ -36,7 +36,6 @@ #include <limits> - namespace google { namespace protobuf { namespace internal { @@ -51,8 +50,13 @@ double NaN() { const ::std::string* empty_string_; GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_); +void DeleteEmptyString() { + delete empty_string_; +} + void InitEmptyString() { empty_string_ = new string; + OnShutdown(&DeleteEmptyString); } |