Fix the memory leak of GetEmptyString().
This commit is contained in:
parent
0971bb0d57
commit
06e6690bf2
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue