diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 505fba94ce51d2a398f3fb5369862f29dc5ad5e5..7ce3b287fb7699fbaa4a1ef595869059247fc1be 100755 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -287,7 +287,7 @@ void rpcClose(void *param) { (*taosCleanUpConn[pRpc->connType])(pRpc->udphandle); for (int i = 0; i < pRpc->sessions; ++i) { - if (pRpc->connList[i].user[0]) { + if (pRpc->connList && pRpc->connList[i].user[0]) { rpcCloseConn((void *)(pRpc->connList + i)); } } diff --git a/src/util/src/tqueue.c b/src/util/src/tqueue.c index ed69d7e7c4eb78d7db96f4c5d6516a1dfd2e2990..f1db24b8ce035a244899ccedb428c1216e668b25 100644 --- a/src/util/src/tqueue.c +++ b/src/util/src/tqueue.c @@ -99,7 +99,7 @@ void taosFreeQitem(void *param) { int taosWriteQitem(taos_queue param, int type, void *item) { STaosQueue *queue = (STaosQueue *)param; - STaosQnode *pNode = (STaosQnode *)((char *)item - sizeof(STaosQnode)); + STaosQnode *pNode = (STaosQnode *)(((char *)item) - sizeof(STaosQnode)); pNode->type = type; pthread_mutex_lock(&queue->mutex); @@ -187,6 +187,7 @@ int taosGetQitem(taos_qall param, int *type, void **pitem) { if (pNode) { *pitem = pNode->item; + *type = pNode->type; num = 1; }