diff options
author | Jacob Garber <jgarber1@ualberta.ca> | 2019-03-27 20:41:34 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-04-01 08:02:38 +0000 |
commit | b6d91753fc6afed85e1bce520898a9bdfa4db4a9 (patch) | |
tree | dee7933d3513ba1d22a3e5dbaf51ad85932dddd1 | |
parent | 988ac294c7669f59d39eb536cde7b4a475ce6f40 (diff) | |
download | coreboot-b6d91753fc6afed85e1bce520898a9bdfa4db4a9.tar.xz |
payloads/coreinfo: Free buffer before returning
This fixes a memory leak, which was partially resolved in
2d1e0eb (payloads/coreinfo: Free buffer before returning).
Found-by: Coverity Scan, CID 1373370 (RESOURCE_LEAK)
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Change-Id: I0efe94b9dfb27746828055427029c01c7f407ec2
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32094
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | payloads/coreinfo/timestamps_module.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/payloads/coreinfo/timestamps_module.c b/payloads/coreinfo/timestamps_module.c index 0978f319b0..fe2d2b5c6b 100644 --- a/payloads/coreinfo/timestamps_module.c +++ b/payloads/coreinfo/timestamps_module.c @@ -203,8 +203,10 @@ static int timestamps_module_init(void) SCREEN_X, LINES_SHOWN); /* Sanity check, chars_count must be padded to full line */ - if (chars_count % SCREEN_X != 0) + if (chars_count % SCREEN_X != 0) { + free(buffer); return -2; + } g_lines_count = chars_count / SCREEN_X; g_max_cursor_line = MAX(g_lines_count - 1 - LINES_SHOWN, 0); |