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);
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32921 )
Change subject: util/romcc: Fix memory leak ......................................................................
Patch Set 1: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32921 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M util/romcc/romcc.c 1 file changed, 3 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index 285b023..d60a9a7 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -12601,7 +12601,9 @@ } type = new_type(TYPE_BITFIELD, type, 0); type->elements = value->u.cval; - } + } else + type = clone_type(0, type); + return type; }
@@ -12656,7 +12658,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);