Fix memory leaks - batch 2 (#6417)

This commit is contained in:
Geza Lore
2025-09-10 22:42:45 +01:00
committed by GitHub
parent 57d8bb5d1f
commit f1396fbced
13 changed files with 188 additions and 156 deletions
+4 -2
View File
@@ -759,8 +759,10 @@ class ParamProcessor final {
UINFOTREE(1, pinp, "", "errnode");
pinp->v3error("Can't convert defparam value to constant: Param "
<< pinp->prettyNameQ() << " of " << nodep->prettyNameQ());
pinp->exprp()->replaceWith(new AstConst{
pinp->fileline(), AstConst::WidthedValue{}, modvarp->width(), 0});
AstNode* const exprp = pinp->exprp();
exprp->replaceWith(new AstConst{pinp->fileline(), AstConst::WidthedValue{},
modvarp->width(), 0});
VL_DO_DANGLING(exprp->deleteTree(), exprp);
} else if (origp && exprp->sameTree(origp)) {
// Setting parameter to its default value. Just ignore it.
// This prevents making additional modules, and makes coverage more