Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32921
Change subject: util/romcc: Fix memory leak ......................................................................
util/romcc: Fix memory leak
The 'new_type' function already allocates memory, so it is only necessary to clone the existing type if this function is not called.
Change-Id: I47065204c5f4b6bab022bd7ccf19838c3ce1f86e Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity Scan CID 1129106 --- M util/romcc/romcc.c 1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/21/32921/1
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index b9ec835..96f3812 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -12593,7 +12593,9 @@ } type = new_type(TYPE_BITFIELD, type, 0); type->elements = value->u.cval; - } + } else + type = clone_type(0, type); + return type; }
@@ -12648,7 +12650,6 @@ done = 0; eat(state, TOK_COMMA); } - type = clone_type(0, type); type->field_ident = fident; if (*next) { *next = new_type(type_join, *next, type);