util/romcc: Fix resource leak
Change-Id: I0d260254bab714ec939fc199b3a133b0fc05b10d Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Found-by: Coverity Scan #1129112 Reviewed-on: https://review.coreboot.org/17883 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
8c47b1f833
commit
f23cba082c
|
@ -10779,6 +10779,7 @@ static struct triple *string_constant(struct compile_state *state)
|
||||||
ptr = buf;
|
ptr = buf;
|
||||||
buf = xmalloc(type->elements + str_len + 1, "string_constant");
|
buf = xmalloc(type->elements + str_len + 1, "string_constant");
|
||||||
memcpy(buf, ptr, type->elements);
|
memcpy(buf, ptr, type->elements);
|
||||||
|
free(ptr);
|
||||||
ptr = buf + type->elements;
|
ptr = buf + type->elements;
|
||||||
do {
|
do {
|
||||||
*ptr++ = char_value(state, &str, end);
|
*ptr++ = char_value(state, &str, end);
|
||||||
|
|
Loading…
Reference in New Issue