diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 12d9b170fb..edf702b948 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -122,6 +122,10 @@ int32_t walInitWriteFileForSkip(SWal *pWal) { } pWal->writeCur = 0; _exit: + if (code != TSDB_CODE_SUCCESS) { + if (pIdxTFile) (void)taosCloseFile(&pIdxTFile); + if (pLogTFile) (void)taosCloseFile(&pLogTFile); + } (void)taosCloseFile(&pIdxTFile); (void)taosCloseFile(&pLogTFile); TAOS_RETURN(code);