提交 5d0cc08e 编写于 作者: S Shengliang Guan

[TD_543] fix coverity scan, cid:290455 286428 286450 287977 287995 290226

上级 2f44b5cb
...@@ -61,12 +61,10 @@ static const SDnodeComponent tsDnodeComponents[] = { ...@@ -61,12 +61,10 @@ static const SDnodeComponent tsDnodeComponents[] = {
}; };
static int dnodeCreateDir(const char *dir) { static int dnodeCreateDir(const char *dir) {
struct stat dirstat; if (mkdir(dir, 0755) != 0 && errno != EEXIST) {
if (stat(dir, &dirstat) < 0) { return -1;
if (mkdir(dir, 0755) != 0 && errno != EEXIST) {
return -1;
}
} }
return 0; return 0;
} }
......
...@@ -177,10 +177,12 @@ void dnodeDispatchToMgmtQueue(SRpcMsg *pMsg) { ...@@ -177,10 +177,12 @@ void dnodeDispatchToMgmtQueue(SRpcMsg *pMsg) {
memcpy(item, pMsg, sizeof(SRpcMsg)); memcpy(item, pMsg, sizeof(SRpcMsg));
taosWriteQitem(tsMgmtQueue, 1, item); taosWriteQitem(tsMgmtQueue, 1, item);
} else { } else {
SRpcMsg rsp; SRpcMsg rsp = {
rsp.handle = pMsg->handle; .handle = pMsg->handle,
rsp.pCont = NULL; .pCont = NULL,
rsp.code = TSDB_CODE_DND_OUT_OF_MEMORY; .code = TSDB_CODE_DND_OUT_OF_MEMORY
};
rpcSendResponse(&rsp); rpcSendResponse(&rsp);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
} }
...@@ -188,9 +190,9 @@ void dnodeDispatchToMgmtQueue(SRpcMsg *pMsg) { ...@@ -188,9 +190,9 @@ void dnodeDispatchToMgmtQueue(SRpcMsg *pMsg) {
static void *dnodeProcessMgmtQueue(void *param) { static void *dnodeProcessMgmtQueue(void *param) {
SRpcMsg *pMsg; SRpcMsg *pMsg;
SRpcMsg rsp; SRpcMsg rsp = {0};
int type; int type;
void *handle; void * handle;
while (1) { while (1) {
if (taosReadQitemFromQset(tsMgmtQset, &type, (void **) &pMsg, &handle) == 0) { if (taosReadQitemFromQset(tsMgmtQset, &type, (void **) &pMsg, &handle) == 0) {
...@@ -251,6 +253,7 @@ static int32_t dnodeOpenVnodes() { ...@@ -251,6 +253,7 @@ static int32_t dnodeOpenVnodes() {
if (status != TSDB_CODE_SUCCESS) { if (status != TSDB_CODE_SUCCESS) {
dPrint("Get dnode list failed"); dPrint("Get dnode list failed");
free(vnodeList);
return status; return status;
} }
...@@ -290,6 +293,7 @@ static void dnodeCloseVnodes() { ...@@ -290,6 +293,7 @@ static void dnodeCloseVnodes() {
if (status != TSDB_CODE_SUCCESS) { if (status != TSDB_CODE_SUCCESS) {
dPrint("Get dnode list failed"); dPrint("Get dnode list failed");
free(vnodeList);
return; return;
} }
...@@ -456,6 +460,7 @@ static bool dnodeReadMnodeInfos() { ...@@ -456,6 +460,7 @@ static bool dnodeReadMnodeInfos() {
return false; return false;
} }
content[len] = 0;
cJSON* root = cJSON_Parse(content); cJSON* root = cJSON_Parse(content);
if (root == NULL) { if (root == NULL) {
dError("failed to read mnodeIpList.json, invalid json format"); dError("failed to read mnodeIpList.json, invalid json format");
...@@ -628,6 +633,7 @@ static bool dnodeReadDnodeCfg() { ...@@ -628,6 +633,7 @@ static bool dnodeReadDnodeCfg() {
return false; return false;
} }
content[len] = 0;
cJSON* root = cJSON_Parse(content); cJSON* root = cJSON_Parse(content);
if (root == NULL) { if (root == NULL) {
dError("failed to read dnodeCfg.json, invalid json format"); dError("failed to read dnodeCfg.json, invalid json format");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册