]> git.gag.com Git - fw/openocd/commit
log: fix memory leak when log to file is enabled
authorAntonio Borneo <borneo.antonio@gmail.com>
Fri, 24 Dec 2021 14:15:18 +0000 (15:15 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 22 Jan 2022 10:15:48 +0000 (10:15 +0000)
commit492ac453ab6b97280030fe6161dfcac3d84b36ce
tree9739745304fcca993ce9130435218c980291db07
parent1536e249f2c23399f3443f8351647ea3faa5112e
log: fix memory leak when log to file is enabled

When log to file is enabled, the file is not closed by OpenOCD at
exit. This is reported by Valgrind as a memory leak that is still
reachable, as the internal buffers of 'FILE *log_output' are freed
by the automatic fclose() at exit.

Close the log file before exit.

Change-Id: Id472c0d04462035254a9b49ecb0a4037263c6f6f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6789
Tested-by: jenkins
src/helper/log.c
src/helper/log.h
src/openocd.c