Plug memory leaks (#5016)

This commit is contained in:
Geza Lore
2024-03-23 22:12:43 +00:00
committed by GitHub
parent 38ad328956
commit 9b729b80e0
16 changed files with 70 additions and 29 deletions
+4
View File
@@ -372,7 +372,11 @@ 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};
// 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);
}