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>
This commit is contained in:
parent
4b688ab3fe
commit
9742ae1d11
|
@ -12601,7 +12601,9 @@ static struct type *struct_declarator(
|
||||||
}
|
}
|
||||||
type = new_type(TYPE_BITFIELD, type, 0);
|
type = new_type(TYPE_BITFIELD, type, 0);
|
||||||
type->elements = value->u.cval;
|
type->elements = value->u.cval;
|
||||||
}
|
} else
|
||||||
|
type = clone_type(0, type);
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12656,7 +12658,6 @@ static struct type *struct_or_union_specifier(
|
||||||
done = 0;
|
done = 0;
|
||||||
eat(state, TOK_COMMA);
|
eat(state, TOK_COMMA);
|
||||||
}
|
}
|
||||||
type = clone_type(0, type);
|
|
||||||
type->field_ident = fident;
|
type->field_ident = fident;
|
||||||
if (*next) {
|
if (*next) {
|
||||||
*next = new_type(type_join, *next, type);
|
*next = new_type(type_join, *next, type);
|
||||||
|
|
Loading…
Reference in New Issue