[coreboot-gerrit] Change in coreboot[master]: payloads/coreinfo: Free buffer before returning

Martin Roth (Code Review) gerrit at coreboot.org
Thu Aug 3 18:55:57 CEST 2017


Martin Roth has uploaded this change for review. ( https://review.coreboot.org/20876


Change subject: payloads/coreinfo: Free buffer before returning
......................................................................

payloads/coreinfo: Free buffer before returning

Fixes coverity issue 1373370 - Resource leak

Change-Id: I71e0d3ae7f9152e1f89f8b3206526f0d344e0351
Signed-off-by: Martin Roth <martinroth at google.com>
---
M payloads/coreinfo/timestamps_module.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/20876/1

diff --git a/payloads/coreinfo/timestamps_module.c b/payloads/coreinfo/timestamps_module.c
index 020fcc6..fda5a96 100644
--- a/payloads/coreinfo/timestamps_module.c
+++ b/payloads/coreinfo/timestamps_module.c
@@ -210,8 +210,10 @@
 	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) {

-- 
To view, visit https://review.coreboot.org/20876
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I71e0d3ae7f9152e1f89f8b3206526f0d344e0351
Gerrit-Change-Number: 20876
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170803/41fcbb40/attachment.html>


More information about the coreboot-gerrit mailing list