diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-11 19:08:58 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-11 19:08:58 -0700 |
commit | b7a38a1dd4dedbb4c83dcc61801aa588420543b4 (patch) | |
tree | b19739ce48fd873d56a466b257314d3719526888 | |
parent | 4c0c5eb5a4119ab097b3ec77190a057bf81b945d (diff) | |
download | mu-b7a38a1dd4dedbb4c83dcc61801aa588420543b4.tar.gz |
3330
Fix CI #2: memory leaks.
-rw-r--r-- | 018type_abbreviations.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/018type_abbreviations.cc b/018type_abbreviations.cc index 354de61d..99491d79 100644 --- a/018type_abbreviations.cc +++ b/018type_abbreviations.cc @@ -16,6 +16,8 @@ map<string, type_tree*> Type_abbreviations, Type_abbreviations_snapshot; Type_abbreviations_snapshot = Type_abbreviations; :(before "End restore_snapshots") restore_type_abbreviations(); +:(before "End One-time Setup") +atexit(clear_type_abbreviations); :(code) void restore_type_abbreviations() { for (map<string, type_tree*>::iterator p = Type_abbreviations.begin(); p != Type_abbreviations.end(); ++p) { @@ -25,6 +27,11 @@ void restore_type_abbreviations() { Type_abbreviations.clear(); Type_abbreviations = Type_abbreviations_snapshot; } +void clear_type_abbreviations() { + for (map<string, type_tree*>::iterator p = Type_abbreviations.begin(); p != Type_abbreviations.end(); ++p) + delete p->second; + Type_abbreviations.clear(); +} :(before "End Command Handlers") else if (command == "type") { |