fix: coverity issues

This commit is contained in:
Shengliang Guan 2023-01-12 16:04:57 +08:00
parent 48adbf6e24
commit e6b4031487
3 changed files with 14 additions and 7 deletions

View File

@ -201,12 +201,14 @@ static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) {
terrno = 0; terrno = 0;
_OVER: _OVER:
if (terrno != 0 && pSma != NULL) { if (terrno != 0) {
mError("sma:%s, failed to decode from raw:%p since %s", pSma->name, pRaw, terrstr()); if (pSma != NULL) {
taosMemoryFreeClear(pSma->expr); mError("sma:%s, failed to decode from raw:%p since %s", pSma->name, pRaw, terrstr());
taosMemoryFreeClear(pSma->tagsFilter); taosMemoryFreeClear(pSma->expr);
taosMemoryFreeClear(pSma->sql); taosMemoryFreeClear(pSma->tagsFilter);
taosMemoryFreeClear(pSma->ast); taosMemoryFreeClear(pSma->sql);
taosMemoryFreeClear(pSma->ast);
}
taosMemoryFreeClear(pRow); taosMemoryFreeClear(pRow);
return NULL; return NULL;
} }

View File

@ -271,6 +271,11 @@ SSyncFSM *mndSyncMakeFsm(SMnode *pMnode) {
int32_t mndInitSync(SMnode *pMnode) { int32_t mndInitSync(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt; SSyncMgmt *pMgmt = &pMnode->syncMgmt;
taosThreadMutexInit(&pMgmt->lock, NULL); taosThreadMutexInit(&pMgmt->lock, NULL);
taosThreadMutexLock(&pMgmt->lock);
pMgmt->transId = 0;
pMgmt->transSec = 0;
pMgmt->transSeq = 0;
taosThreadMutexUnlock(&pMgmt->lock);
SSyncInfo syncInfo = { SSyncInfo syncInfo = {
.snapshotStrategy = SYNC_STRATEGY_STANDARD_SNAPSHOT, .snapshotStrategy = SYNC_STRATEGY_STANDARD_SNAPSHOT,

View File

@ -227,8 +227,8 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
uError("worker:%s:%d failed to create", pool->name, curWorkerNum); uError("worker:%s:%d failed to create", pool->name, curWorkerNum);
taosMemoryFree(worker); taosMemoryFree(worker);
taosCloseQueue(queue); taosCloseQueue(queue);
terrno = TSDB_CODE_OUT_OF_MEMORY;
taosThreadMutexUnlock(&pool->mutex); taosThreadMutexUnlock(&pool->mutex);
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL; return NULL;
} }
worker->id = curWorkerNum; worker->id = curWorkerNum;