diff --git a/services/sim/src/operator_file_parser.cpp b/services/sim/src/operator_file_parser.cpp index 72b48736ec8dceddfe74282730d8532e39c87977..8172c9534d8b7de67c2c46e64fee6bf0451f89cc 100644 --- a/services/sim/src/operator_file_parser.cpp +++ b/services/sim/src/operator_file_parser.cpp @@ -52,6 +52,8 @@ bool OperatorFileParser::WriteOperatorConfigJson(std::string filename, const cJS char *cjValue = cJSON_Print(root); if (cjValue == nullptr) { printf("ParseJsonFailed"); + (void)fclose(file); + file = nullptr; return false; } int ret = fwrite(cjValue, sizeof(char), strlen(cjValue), file);