Fixing ref'counting problem.

This commit is contained in:
Robin Sommer 2011-08-15 20:56:59 -07:00
parent 2af9d9bc20
commit f9cd97d78d
2 changed files with 2 additions and 4 deletions

View file

@ -5022,13 +5022,11 @@ Val* ListExpr::InitVal(const BroType* t, Val* aggr) const
Expr* e = exprs[i];
check_and_promote_expr(e, vec->Type()->AsVectorType()->YieldType());
Val* v = e->Eval(0);
if ( ! vec->Assign(i, v->RefCnt() == 1 ? v->Ref() : v, e) )
if ( ! vec->Assign(i, v, e) )
{
e->Error(fmt("type mismatch at index %d", i));
return 0;
}
Unref(v);
}
return aggr;