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>
This commit is contained in:
parent
98e73c8344
commit
1ca8f8818b
|
@ -432,9 +432,10 @@ static int read_trace_config(FILE *fin)
|
||||||
|
|
||||||
err = regcomp(&line->regex, tok, REG_NOSUB);
|
err = regcomp(&line->regex, tok, REG_NOSUB);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
int r = regex_report_error(&line->regex, err,
|
||||||
|
"compile", tok);
|
||||||
free(line);
|
free(line);
|
||||||
return regex_report_error(&line->regex, err, "compile",
|
return r;
|
||||||
tok);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* link this new one to the end of the list */
|
/* link this new one to the end of the list */
|
||||||
|
|
Loading…
Reference in New Issue