Merge pull request #17245 from taosdata/fix/TD-19245
fix: coverity issues
This commit is contained in:
commit
dccf33ec67
|
@ -94,6 +94,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
|
|||
pCfgs = taosMemoryCalloc(vnodesNum, sizeof(SWrapperCfg));
|
||||
if (pCfgs == NULL) {
|
||||
dError("failed to read %s since out of memory", file);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -104,6 +105,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
|
|||
cJSON *vgId = cJSON_GetObjectItem(vnode, "vgId");
|
||||
if (!vgId || vgId->type != cJSON_Number) {
|
||||
dError("failed to read %s since vgId not found", file);
|
||||
taosMemoryFree(pCfgs);
|
||||
goto _OVER;
|
||||
}
|
||||
pCfg->vgId = vgId->valueint;
|
||||
|
@ -112,6 +114,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
|
|||
cJSON *dropped = cJSON_GetObjectItem(vnode, "dropped");
|
||||
if (!dropped || dropped->type != cJSON_Number) {
|
||||
dError("failed to read %s since dropped not found", file);
|
||||
taosMemoryFree(pCfgs);
|
||||
goto _OVER;
|
||||
}
|
||||
pCfg->dropped = dropped->valueint;
|
||||
|
@ -119,6 +122,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
|
|||
cJSON *vgVersion = cJSON_GetObjectItem(vnode, "vgVersion");
|
||||
if (!vgVersion || vgVersion->type != cJSON_Number) {
|
||||
dError("failed to read %s since vgVersion not found", file);
|
||||
taosMemoryFree(pCfgs);
|
||||
goto _OVER;
|
||||
}
|
||||
pCfg->vgVersion = vgVersion->valueint;
|
||||
|
@ -135,7 +139,6 @@ _OVER:
|
|||
if (content != NULL) taosMemoryFree(content);
|
||||
if (root != NULL) cJSON_Delete(root);
|
||||
if (pFile != NULL) taosCloseFile(&pFile);
|
||||
if (code != 0) taosMemoryFree(pCfgs);
|
||||
|
||||
terrno = code;
|
||||
return code;
|
||||
|
|
|
@ -65,6 +65,7 @@ static SProcQueue *dmInitProcQueue(SProc *proc, char *ptr, int32_t size) {
|
|||
}
|
||||
|
||||
if (proc->ptype & DND_PROC_PARENT) {
|
||||
memset(ptr, 0, sizeof(SProcQueue));
|
||||
if (dmInitProcMutex(queue) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -76,11 +77,11 @@ static SProcQueue *dmInitProcQueue(SProc *proc, char *ptr, int32_t size) {
|
|||
tstrncpy(queue->name, proc->name, sizeof(queue->name));
|
||||
|
||||
taosThreadMutexLock(&queue->mutex);
|
||||
queue->head = 0;
|
||||
queue->tail = 0;
|
||||
// queue->head = 0;
|
||||
// queue->tail = 0;
|
||||
queue->total = bufSize;
|
||||
queue->avail = bufSize;
|
||||
queue->items = 0;
|
||||
// queue->items = 0;
|
||||
taosThreadMutexUnlock(&queue->mutex);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
|
|||
dnodeObj.port = tsServerPort;
|
||||
tstrncpy(dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN);
|
||||
dnodeObj.fqdn[TSDB_FQDN_LEN - 1] = 0;
|
||||
snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
|
||||
snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-dnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
@ -490,7 +490,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
|
|||
dnodeObj.updateTime = dnodeObj.createdTime;
|
||||
dnodeObj.port = pCreate->port;
|
||||
tstrncpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN);
|
||||
snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
|
||||
snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", pCreate->fqdn, pCreate->port);
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
|
|
@ -22,6 +22,8 @@ int32_t tGenIdPI32(void) {
|
|||
if (tUUIDHashId == 0) {
|
||||
char uid[65] = {0};
|
||||
int32_t code = taosGetSystemUUID(uid, sizeof(uid));
|
||||
uid[64] = 0;
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue