From: Vincent Stehlé Date: Wed, 7 Oct 2015 13:48:48 +0000 (+0200) Subject: tools/proftool: fix use-after-free X-Git-Tag: v2016.01-rc1~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1ca8f8818ba82d7d62cf87dfa3f45e011da62526;p=oweals%2Fu-boot.git 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é Cc: Simon Glass --- diff --git a/tools/proftool.c b/tools/proftool.c index 9ce7a7796e..ddf870f66e 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 */