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
+2 -2
View File
@@ -371,12 +371,12 @@ void V3Broken::allowMidvisitorCheck(bool flag) { s_brokenAllowMidvisitorCheck =
void V3Broken::selfTest() {
// Exercise addNewed and deleted for coverage, as otherwise only used with VL_LEAK_CHECKS
FileLine* const fl = new FileLine{FileLine::commandLineFilename()};
const AstNode* const newp = new AstBegin{fl, "[EditWrapper]", nullptr};
AstNode* const newp = new AstBegin{fl, "[EditWrapper]", nullptr};
// Don't actually do it with VL_LEAK_CHECKS, when new/delete calls these.
// Otherwise you call addNewed twice on the same address, which is an error.
#ifndef VL_LEAK_CHECKS
addNewed(newp);
deleted(newp);
#endif
VL_DO_DANGLING(delete newp, newp);
VL_DO_DANGLING(newp->deleteTree(), newp);
}