Free event_path if malloc() doesn't succeed. Fixes a RESOURCE_LEAK error (CWE-772) Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx> --- lib/trace-cmd/trace-output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c index c270d03f..7be175af 100644 --- a/lib/trace-cmd/trace-output.c +++ b/lib/trace-cmd/trace-output.c @@ -868,8 +868,10 @@ static void glob_events(struct tracecmd_output *handle, path = malloc(events_len + strlen(str) + strlen("/format") + 2); - if (!path) + if (!path) { + put_tracing_file(events_path); return; + } path[0] = '\0'; strcat(path, events_path); strcat(path, "/"); -- 2.44.0