about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--018type_abbreviations.cc7
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") {