In show_error() the pointer p is used for several functions. At first, it contain a substring of path. Then it is replaced by either an allocated string containing the path to the error log file or the result of read_path(), neither of which are freed when exiting. Free p in both case in the exit path. Fixes a RESOURCE_LEAK error (CWE-772) Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx> --- tracecmd/trace-record.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index a008cdfd..3c42cdf0 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -2374,6 +2374,7 @@ static void show_error(const char *file, const char *type) out: printf("Failed %s of %s\n", type, file); + free(p); free(path); return; } -- 2.47.0