summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2017-08-03 10:55:01 -0600
committerMartin Roth <martinroth@google.com>2017-09-11 16:23:52 +0000
commit2d1e0eb8a77ff4eb08b3ccd059d3eee3bef2201d (patch)
tree627e45477abcfc0512618d1d8f3a61f354128b8a
parent6223a200aa1ecff4d4f30b7ebafab7fc24ec04f6 (diff)
downloadcoreboot-2d1e0eb8a77ff4eb08b3ccd059d3eee3bef2201d.tar.xz
payloads/coreinfo: Free buffer before returning
Fixes coverity issue 1373370 - Resource leak Change-Id: I71e0d3ae7f9152e1f89f8b3206526f0d344e0351 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20876 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
-rw-r--r--payloads/coreinfo/timestamps_module.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/payloads/coreinfo/timestamps_module.c b/payloads/coreinfo/timestamps_module.c
index 020fcc6971..fda5a9608a 100644
--- a/payloads/coreinfo/timestamps_module.c
+++ b/payloads/coreinfo/timestamps_module.c
@@ -210,8 +210,10 @@ static int timestamps_module_init(void)
g_max_cursor_line = MAX(g_lines_count - 1 - LINES_SHOWN, 0);
g_buf = malloc(chars_count);
- if (!g_buf)
+ if (!g_buf) {
+ free(buffer);
return -3;
+ }
if (sanitize_buffer_for_display(buffer, buff_cur + 1, g_buf,
chars_count, SCREEN_X) < 0) {