A number of issues were found by running static analysers on the code of trace-cmd with openscanhub[1]. Mostly ressource leak, but some are more serious like memory corruption. [1] https://fedoraproject.org/wiki/OpenScanHub Jerome Marchand (38): trace-cmd listen: close ofd before exiting process_client() trace-cmd msg: prevent a memory leak in get_trace_req_args() trace-cmd lib: prevent a memory leak in read_header_files() trace-cmd: call dlclose() in the error path of load_plugin() trace-cmd lib: prevent possible memory coruption in add_plugin_file() trace-cmd lib: prevent a memory leak in handle_options() trace-cmd lib: prevent a memory leak in regex_event_buf() trace-cmd lib: prevent a memory leak in create_event_list_item() trace-cmd lib: prevent a memory leak in read_ftrace_printk() trace-cmd: don't print a NULL string in append_pid_filter() trace-cmd record: prevent possible memory coruption in get_pid_addr_maps() trace-cmd hist: close tracecmd handle when trace_hist() exits early trace-cmd record: prevent a memory leak in show_error() trace-cmd record: prevent memory leak in update_pid_filters() trace-cmd lib: check the return value of do_lssek() in trace_get_options() trace-cmd lib: don't double close a file descriptor in read_header_files() trace-cmd lib: prevent memory leak in ptp_clock_server() trace-cmd lib: remove useless code in tracecmd_plog() trace-cmd record: prevent memory leak in add_all_instances() trace-cmd lib: check for a negative return value of read in tracecmd_compress_copy_from() trace-cmd record: prevent memory leak in clear_func_filter() trace-cmd dump: prevent buffer overrun in dump_clock() trace-cmd lib: prevent buffer overrun in read_string() trace-cmd: close file descriptor in trace_vsock_make() trace-cmd lib: prevent memory leak in glob_events() trace-cmd record: don't print a NULL string in get_temp_file() trace-cmd lib: prevent a possible file descriptor leak in set_proc_kptr_restrict() trace-cmd lib: remove unused tracecmd_parse_cmdlines() function trace-cmd record: prevent memory leak in setup_network() trace-cmd listen: prevent memory leak in communicate_with_client() trace-cmd listen: prevent a infinite loop in communicate_with_client() trace-cmd lib: prevent memory leak in tracecmd_create_event_hook() trace-cmd record: prevent memory corruption in parse_record_options() trace-cmd mem: prevent a memory leak in trace_mem() trace-cmd: move the initialization of found_pid at the beginning of stop_trace_connect() trace-cmd record: check the length of the protocol version received trace-cmd record: close socket fd before retrying to connect trace-cmd lib: prevent a memory leak in tracecmd_tsync_proto_getall() lib/trace-cmd/trace-compress.c | 4 +-- lib/trace-cmd/trace-hooks.c | 1 + lib/trace-cmd/trace-input.c | 17 +++++++------ lib/trace-cmd/trace-msg.c | 13 ++-------- lib/trace-cmd/trace-output.c | 39 +++++++++++++++++++----------- lib/trace-cmd/trace-plugin.c | 8 +++--- lib/trace-cmd/trace-timesync-ptp.c | 4 ++- lib/trace-cmd/trace-timesync.c | 2 +- lib/trace-cmd/trace-util.c | 26 ++------------------ tracecmd/trace-dump.c | 2 +- tracecmd/trace-hist.c | 4 ++- tracecmd/trace-listen.c | 13 +++++++--- tracecmd/trace-mem.c | 3 ++- tracecmd/trace-read.c | 2 +- tracecmd/trace-record.c | 19 +++++++++++---- tracecmd/trace-vm.c | 2 +- tracecmd/trace-vsock.c | 8 ++++-- 17 files changed, 87 insertions(+), 80 deletions(-) -- 2.44.0