Message ID | 20241029080117.625177-8-jmarchan@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 59d2c3f9cab63a3ffc845e823eb049450851e4f8 |
Headers | show |
Series | trace-cmd: fix misc issues found by static analysis | expand |
diff --git a/tracecmd/trace-mem.c b/tracecmd/trace-mem.c index 3e1ac9f3..b8babbbc 100644 --- a/tracecmd/trace-mem.c +++ b/tracecmd/trace-mem.c @@ -554,10 +554,8 @@ void trace_mem(int argc, char **argv) die("can't open %s\n", input_file); ret = tracecmd_read_headers(handle, 0); - if (ret) - return; - - do_trace_mem(handle); + if (!ret) + do_trace_mem(handle); tracecmd_close(handle); }
Close the tracecmd handle in the error path. Fixes a RESOURCE_LEAK error (CWE-772) Signed-off-by: Jerome Marchand <jmarchan@redhat.com> --- tracecmd/trace-mem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)