diff options
author | Marcelina KoĆcielnicka <mwk@0x04.net> | 2021-06-14 16:28:10 +0200 |
---|---|---|
committer | Marcelina KoĆcielnicka <mwk@0x04.net> | 2021-06-14 17:07:41 +0200 |
commit | 801ecc0e1d75f092981361632265edce67130a73 (patch) | |
tree | bb8151cec247c419545a909c7d9ce51e49b6d637 /frontends/verilog/verilog_frontend.cc | |
parent | 438bcc68c0859057e4d3f521d1c865d2a9d90e15 (diff) | |
download | yosys-801ecc0e1d75f092981361632265edce67130a73.tar.gz yosys-801ecc0e1d75f092981361632265edce67130a73.tar.bz2 yosys-801ecc0e1d75f092981361632265edce67130a73.zip |
verilog: Squash a memory leak.
That was added in ecc22f7fedfa639482dbc55a05709da85116a60f
Diffstat (limited to 'frontends/verilog/verilog_frontend.cc')
-rw-r--r-- | frontends/verilog/verilog_frontend.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/frontends/verilog/verilog_frontend.cc b/frontends/verilog/verilog_frontend.cc index ad0bb9ff7..9b277c6b9 100644 --- a/frontends/verilog/verilog_frontend.cc +++ b/frontends/verilog/verilog_frontend.cc @@ -482,18 +482,18 @@ struct VerilogFrontend : public Frontend { // make package typedefs available to parser add_package_types(pkg_user_types, design->verilog_packages); - UserTypeMap *global_types_map = new UserTypeMap(); + UserTypeMap global_types_map; for (auto def : design->verilog_globals) { if (def->type == AST::AST_TYPEDEF) { - (*global_types_map)[def->str] = def; + global_types_map[def->str] = def; } } log_assert(user_type_stack.empty()); // use previous global typedefs as bottom level of user type stack - user_type_stack.push_back(global_types_map); + user_type_stack.push_back(std::move(global_types_map)); // add a new empty type map to allow overriding existing global definitions - user_type_stack.push_back(new UserTypeMap()); + user_type_stack.push_back(UserTypeMap()); frontend_verilog_yyset_lineno(1); frontend_verilog_yyrestart(NULL); @@ -519,10 +519,6 @@ struct VerilogFrontend : public Frontend { // only the previous and new global type maps remain log_assert(user_type_stack.size() == 2); - for (auto it : user_type_stack) { - // the global typedefs have to remain valid for future invocations, so just drop the map without deleting values - delete it; - } user_type_stack.clear(); delete current_ast; |