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:
Patrick Georgi 2016-12-15 15:12:16 +01:00 committed by Patrick Georgi
parent 8c47b1f833
commit f23cba082c
1 changed files with 1 additions and 0 deletions

View File

@ -10779,6 +10779,7 @@ static struct triple *string_constant(struct compile_state *state)
ptr = buf;
buf = xmalloc(type->elements + str_len + 1, "string_constant");
memcpy(buf, ptr, type->elements);
free(ptr);
ptr = buf + type->elements;
do {
*ptr++ = char_value(state, &str, end);