From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> If get_file_content() returns NULL, because the file does not exist or for any other reason, it will cause add_reset_file() to trigger a SEGSEGV due to using a NULL pointer. Only call add_reset_file() if get_file_content() actually returns something. Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- tracecmd/trace-record.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 2d716a81acbf..5dc6f17aa743 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -270,8 +270,10 @@ static void reset_save_file(const char *file, int prio) char *content; content = get_file_content(file); - add_reset_file(file, content, prio); - free(content); + if (content) { + add_reset_file(file, content, prio); + free(content); + } } /* -- 2.20.1
![]() |