public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tools/proftool: fix use-after-free
@ 2015-10-07 13:48 Vincent Stehlé
  2015-10-07 14:19 ` Tom Rini
  2015-11-17  1:40 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Vincent Stehlé @ 2015-10-07 13:48 UTC (permalink / raw)
  To: u-boot

The read_trace_config() can dereference the line pointer after freeing
it on its error path. Avoid that.

This was found by Coverity Scan.

Signed-off-by: Vincent Stehl? <vincent.stehle@freescale.com>
Cc: Simon Glass <sjg@chromium.org>
---
 tools/proftool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/proftool.c b/tools/proftool.c
index 9ce7a77..ddf870f 100644
--- a/tools/proftool.c
+++ b/tools/proftool.c
@@ -432,9 +432,10 @@ static int read_trace_config(FILE *fin)
 
 		err = regcomp(&line->regex, tok, REG_NOSUB);
 		if (err) {
+			int r = regex_report_error(&line->regex, err,
+						   "compile", tok);
 			free(line);
-			return regex_report_error(&line->regex, err, "compile",
-						  tok);
+			return r;
 		}
 
 		/* link this new one to the end of the list */
-- 
2.5.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-17  1:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-07 13:48 [U-Boot] [PATCH] tools/proftool: fix use-after-free Vincent Stehlé
2015-10-07 14:19 ` Tom Rini
2015-10-07 14:35   ` Vincent Stehlé
2015-10-07 15:42     ` Tom Rini
2015-11-17  1:40 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox