From 46ecbd400e07d6139586314035d1d741956bfe40 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 24 Feb 2020 13:37:51 +0100 Subject: [PATCH] Expr: fix memory leak in RecordCoerceExpr::InitVal() Caused by commit b1fd1612740d554bf6681888e6920e982ceb5200 --- src/Expr.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Expr.cc b/src/Expr.cc index 64c4f47156..ec62024553 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -3776,12 +3776,10 @@ Val* RecordCoerceExpr::InitVal(const BroType* t, Val* aggr) const { RecordVal* rv = v->AsRecordVal(); RecordVal* ar = rv->CoerceTo(t->AsRecordType(), aggr); + Unref(rv); if ( ar ) - { - Unref(rv); return ar; - } } Error("bad record initializer");