summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElyes HAOUAS <ehaouas@noos.fr>2019-07-18 15:08:10 +0200
committerNico Huber <nico.h@gmx.de>2019-07-19 16:20:08 +0000
commitef78de4a21323b8c459337356289218211f2c5ce (patch)
tree5f6b24b01b1091c97ce32e72fb8424c2d8e9b9c1
parent5800f5841de2fd74bfc6590978bd034a6c9e6102 (diff)
downloadflashrom-ef78de4a21323b8c459337356289218211f2c5ce.tar.gz
flashrom-ef78de4a21323b8c459337356289218211f2c5ce.tar.bz2
flashrom-ef78de4a21323b8c459337356289218211f2c5ce.zip
cli_classic: Fix Memory leak
Found-by: scan-build 7.0.1-8 Change-Id: I84e642b57b95953f376569e443ef8d8eda7bf98f Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/flashrom/+/34405 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--cli_classic.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cli_classic.c b/cli_classic.c
index b79f953cb..0591bfeba 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -383,6 +383,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "Log file not supported in standalone mode. Aborting.\n");
cli_classic_abort_usage();
#else /* STANDALONE */
+ if (logfile) {
+ fprintf(stderr, "Warning: -o/--output specified multiple times.\n");
+ free(logfile);
+ }
+
logfile = strdup(optarg);
if (logfile[0] == '\0') {
fprintf(stderr, "No log filename specified.\n");