trace-cmd lib: Don't double close a file descriptor in read_header_files()
In read_header_files(), if we encounter an error after we close the
first file but before we open the second one, the exit code tries to
close it again.
Move the call to close() just before the second open to prevent that.
Fixes a USE_AFTER_FREE error (CWE-416)
Link: https://lore.kernel.org/linux-trace-devel/[email protected]
Signed-off-by: Jerome Marchand <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 file changed