Fixes memory leak in verilog attribute code.
There appears to be two leaks one with string handling, and one with Dcl not freeing the attribute stmt list when it returns nullptr. Signed-off-by: Ethan Mahintorabi <ethanmoon@google.com>
This commit is contained in:
parent
d34cde34cd
commit
7335731753
|
|
@ -505,9 +505,14 @@ attr_specs:
|
||||||
|
|
||||||
attr_spec:
|
attr_spec:
|
||||||
ID
|
ID
|
||||||
{ $$ = new sta::VerilogAttributeEntry($1, "1"); }
|
{ $$ = new sta::VerilogAttributeEntry($1, "1");
|
||||||
|
delete[] $1;
|
||||||
|
}
|
||||||
| ID '=' attr_spec_value
|
| ID '=' attr_spec_value
|
||||||
{ $$ = new sta::VerilogAttributeEntry($1, $3); }
|
{ $$ = new sta::VerilogAttributeEntry($1, $3);
|
||||||
|
delete[] $1;
|
||||||
|
delete[] $3;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
attr_spec_value:
|
attr_spec_value:
|
||||||
|
|
|
||||||
|
|
@ -424,8 +424,11 @@ VerilogReader::makeDcl(PortDirection *dir,
|
||||||
dcl_count_++;
|
dcl_count_++;
|
||||||
return new VerilogDcl(dir, assign_args, attribute_stmts, line);
|
return new VerilogDcl(dir, assign_args, attribute_stmts, line);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
attribute_stmts->deleteContents();
|
||||||
|
delete attribute_stmts;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dcl_count_++;
|
dcl_count_++;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue