diff mbox series

[14/38] trace-cmd record: prevent memory leak in update_pid_filters()

Message ID 20240605134054.2626953-15-jmarchan@redhat.com (mailing list archive)
State Accepted
Commit e8a577b4ba9a8d3cb9ebf4dc76cfc2c3c7cac2e6
Headers show
Series trace-cmd: fix misc issues found by static analysis | expand

Commit Message

Jerome Marchand June 5, 2024, 1:40 p.m. UTC
Free filter before exiting update_pid_filters()

Fixes a RESOURCE_LEAK error (CWE-772)

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 tracecmd/trace-record.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 3e29f922..c4d43469 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -2881,6 +2881,7 @@  static void update_pid_filters(struct buffer_instance *instance)
 	} while (ret >= 0 && len);
 
  out:
+	free(filter);
 	close(fd);
 }