From 13ca80eecfcc50496fe210aac8f07d2c711025e0 Mon Sep 17 00:00:00 2001 From: Wenke Yang Date: Sun, 15 May 2022 20:58:00 +0800 Subject: [PATCH] link #I57H9Z fixed gstrace file open seg fault error --- src/lib/gstrace/common/gstrace_infra.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/gstrace/common/gstrace_infra.cpp b/src/lib/gstrace/common/gstrace_infra.cpp index 283e2f854..16ce54cff 100644 --- a/src/lib/gstrace/common/gstrace_infra.cpp +++ b/src/lib/gstrace/common/gstrace_infra.cpp @@ -1158,7 +1158,7 @@ FILE* trace_fopen(const char* open_file, const char* mode) canonicalize_path(file_name); fp = fopen(file_name, mode); - if (chmod(file_name, S_IWUSR | S_IRUSR) != 0) { + if (fp != NULL && chmod(file_name, S_IWUSR | S_IRUSR) != 0) { fclose(fp); return NULL; }