mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-20 03:12:05 +00:00
Merge pull request #5217 from rocallahan/fix-importSigSpecWorker-leak
Fix space leak in `SatGen::importSigSpecWorker()` by avoiding `log_id…
This commit is contained in:
commit
dfe86b50d8
2 changed files with 6 additions and 10 deletions
|
@ -664,15 +664,9 @@ const char *log_const(const RTLIL::Const &value, bool autoint)
|
|||
|
||||
const char *log_id(const RTLIL::IdString &str)
|
||||
{
|
||||
log_id_cache.push_back(strdup(str.c_str()));
|
||||
const char *p = log_id_cache.back();
|
||||
if (p[0] != '\\')
|
||||
return p;
|
||||
if (p[1] == '$' || p[1] == '\\' || p[1] == 0)
|
||||
return p;
|
||||
if (p[1] >= '0' && p[1] <= '9')
|
||||
return p;
|
||||
return p+1;
|
||||
std::string unescaped = RTLIL::unescape_id(str);
|
||||
log_id_cache.push_back(strdup(unescaped.c_str()));
|
||||
return log_id_cache.back();
|
||||
}
|
||||
|
||||
const char *log_str(const char *str)
|
||||
|
|
|
@ -101,7 +101,9 @@ struct SatGen
|
|||
else
|
||||
vec.push_back(bit == (undef_mode ? RTLIL::State::Sx : RTLIL::State::S1) ? ez->CONST_TRUE : ez->CONST_FALSE);
|
||||
} else {
|
||||
std::string name = pf + (bit.wire->width == 1 ? stringf("%s", log_id(bit.wire)) : stringf("%s [%d]", log_id(bit.wire->name), bit.offset));
|
||||
std::string wire_name = RTLIL::unescape_id(bit.wire->name);
|
||||
std::string name = pf +
|
||||
(bit.wire->width == 1 ? wire_name : stringf("%s [%d]", wire_name.c_str(), bit.offset));
|
||||
vec.push_back(ez->frozen_literal(name));
|
||||
imported_signals[pf][bit] = vec.back();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue