Message ID | 20241029080117.625177-7-jmarchan@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 1b901134a9e9eacc9c80646a12d27b761d89afd8 |
Headers | show |
Series | trace-cmd: fix misc issues found by static analysis | expand |
diff --git a/lib/trace-cmd/trace-hooks.c b/lib/trace-cmd/trace-hooks.c index a58b5356..aa12f6e9 100644 --- a/lib/trace-cmd/trace-hooks.c +++ b/lib/trace-cmd/trace-hooks.c @@ -151,6 +151,8 @@ struct hook_list *tracecmd_create_event_hook(const char *arg) invalid_tok: tracecmd_warning("Invalid hook format '%s'", arg); + free(hook->str); + free(hook); return NULL; }
Free hook and hook->str in the error path. Fixes a RESOURCE_LEAK error (CWE-772) Signed-off-by: Jerome Marchand <jmarchan@redhat.com> --- lib/trace-cmd/trace-hooks.c | 2 ++ 1 file changed, 2 insertions(+)