fix: coverity issues

This commit is contained in:
Shengliang Guan 2022-09-27 17:16:12 +08:00
parent eead619f1a
commit 6c19c06286
1 changed files with 1 additions and 3 deletions

View File

@ -160,7 +160,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
int32_t len = 0;
int32_t maxLen = MAX_CONTENT_LEN;
char *content = taosMemoryCalloc(1, maxLen + 1);
if (content != NULL) {
if (content == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
ret = -1;
goto _OVER;
@ -184,11 +184,9 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
}
len += snprintf(content + len, maxLen - len, " ]\n");
len += snprintf(content + len, maxLen - len, "}\n");
terrno = 0;
_OVER:
taosWriteFile(pFile, content, len);
taosFsyncFile(pFile);
taosCloseFile(&pFile);