Remove the use of a freed variable.
If a constant is padded the original constant will be freed and replaced with a new one. This results in the ce pointer pointing to freed memory. In reality the second check only needs to be done if the first one is false so avoid the whole issue by only performing the second check if the first on is false.
This commit is contained in:
parent
50a2f55364
commit
aa2a063bc0
|
|
@ -589,8 +589,7 @@ void eval_expr(NetExpr*&expr, int context_width)
|
|||
// The expression is a constant, so resize it if needed.
|
||||
if (ce->expr_width() < (unsigned)context_width) {
|
||||
expr = pad_to_width(expr, context_width, *expr);
|
||||
}
|
||||
if (ce->expr_width() > (unsigned)context_width) {
|
||||
} else if (ce->expr_width() > (unsigned)context_width) {
|
||||
verinum value(ce->value(), context_width);
|
||||
ce = new NetEConst(value);
|
||||
ce->set_line(*expr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue