Fix various potential memory leaks.

Though I expect most not to be exercised in practice.
This commit is contained in:
Jon Siwek 2013-09-12 15:23:52 -05:00
parent c3a4454892
commit 0b97343ff7
29 changed files with 142 additions and 32 deletions

View file

@ -2964,6 +2964,7 @@ Val* IndexExpr::Eval(Frame* f) const
if ( v_v1->Size() != v_v2->Size() )
{
Error("size mismatch, boolean index and vector");
Unref(v_result);
return 0;
}
@ -3803,6 +3804,8 @@ Val* VectorConstructorExpr::InitVal(const BroType* t, Val* aggr) const
if ( ! v || ! vec->Assign(i, v) )
{
Error(fmt("initialization type mismatch at index %d", i), e);
if ( ! aggr )
Unref(vec);
return 0;
}
}
@ -5159,6 +5162,7 @@ Val* ListExpr::InitVal(const BroType* t, Val* aggr) const
if ( exprs.length() != tl->length() )
{
Error("index mismatch", t);
Unref(v);
return 0;
}