summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorVincent Stehlé <vincent.stehle@freescale.com>2015-10-07 15:48:48 +0200
committerTom Rini <trini@konsulko.com>2015-11-16 17:22:18 -0500
commit1ca8f8818ba82d7d62cf87dfa3f45e011da62526 (patch)
tree56d39618f56672bc3e6c9906d5c1fbbb496d4253 /tools
parent98e73c834467ef6f1d3e9a8102745e16b3128ac1 (diff)
downloadu-boot-imx-1ca8f8818ba82d7d62cf87dfa3f45e011da62526.zip
u-boot-imx-1ca8f8818ba82d7d62cf87dfa3f45e011da62526.tar.gz
u-boot-imx-1ca8f8818ba82d7d62cf87dfa3f45e011da62526.tar.bz2
tools/proftool: fix use-after-free
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/proftool.c5
1 files 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 */