fix: refactor return code

This commit is contained in:
kailixu 2024-07-25 09:31:35 +08:00
parent 2c8b7fb766
commit 7ee18c5178
3 changed files with 11 additions and 3 deletions

View File

@ -931,6 +931,7 @@ static int32_t tdAcquireRSmaInfoBySuid(SSma *pSma, int64_t suid, SRSmaInfo **ppR
if (ASSERTS(pRSmaInfo->suid == suid, "suid:%" PRIi64 " != %" PRIi64, pRSmaInfo->suid, suid)) {
TAOS_RETURN(TSDB_CODE_APP_ERROR);
}
*ppRSmaInfo = pRSmaInfo;
TAOS_RETURN(code);
}
taosRUnLockLatch(SMA_ENV_LOCK(pEnv));

View File

@ -524,7 +524,7 @@ static int32_t tsdbFSDoSanAndFix(STFileSystem *fs) {
{ // clear unreferenced files
STfsDir *dir = NULL;
TAOS_CHECK_GOTO(tfsOpendir(fs->tsdb->pVnode->pTfs, fs->tsdb->path, &dir), &lino, _close_dir);
TAOS_CHECK_GOTO(tfsOpendir(fs->tsdb->pVnode->pTfs, fs->tsdb->path, &dir), &lino, _exit);
STFileHash fobjHash = {0};
code = tsdbFSCreateFileObjHash(fs, &fobjHash);

View File

@ -440,7 +440,10 @@ int32_t tfsOpendir(STfs *pTfs, const char *rname, STfsDir **ppDir) {
TAOS_CHECK_GOTO(tfsOpendirImpl(pTfs, pDir), NULL, _exit);
_exit:
taosMemoryFree(pDir);
if (code != 0) {
taosMemoryFreeClear(pDir);
}
*ppDir = pDir;
TAOS_RETURN(code);
}
@ -634,9 +637,13 @@ static int32_t tfsGetDiskByName(STfs *pTfs, const char *dir, STfsDisk **ppDisk)
static int32_t tfsOpendirImpl(STfs *pTfs, STfsDir *pTfsDir) {
STfsDisk *pDisk = NULL;
char adir[TMPNAME_LEN * 2] = "\0";
int32_t code = 0;
if (pTfsDir->pDir != NULL) {
taosCloseDir(&pTfsDir->pDir);
if ((code = taosCloseDir(&pTfsDir->pDir)) != 0) {
fError("%s failed to close dir since %s", __func__, tstrerror(code));
TAOS_RETURN(code);
}
pTfsDir->pDir = NULL;
}