From 5257e812d926601223796a35e80bf2761549fd65 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 12 May 2022 23:04:25 +0800 Subject: [PATCH] fix: invalid read in mbnode test --- source/common/src/tmsgcb.c | 6 +++++- source/dnode/mgmt/mgmt_mnode/src/mmWorker.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/common/src/tmsgcb.c b/source/common/src/tmsgcb.c index 1d15aac44d..e5cfe73cae 100644 --- a/source/common/src/tmsgcb.c +++ b/source/common/src/tmsgcb.c @@ -19,7 +19,11 @@ static SMsgCb tsDefaultMsgCb; -void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb) { tsDefaultMsgCb = *pMsgCb; } +void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb) { + if (tsDefaultMsgCb.pWrapper == NULL) { + tsDefaultMsgCb = *pMsgCb; + } +} int32_t tmsgPutToQueue(const SMsgCb* pMsgCb, EQueueType qtype, SRpcMsg* pReq) { PutToQueueFp fp = pMsgCb->queueFps[qtype]; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c index 57b04b68f3..f55e02e50a 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c @@ -33,7 +33,7 @@ static void mmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) { int32_t code = -1; tmsg_t msgType = pMsg->rpcMsg.msgType; bool isRequest = msgType & 1U; - dTrace("msg:%p, get from mnode queue", pMsg); + dTrace("msg:%p, get from mnode queue, type:%s", pMsg, TMSG_INFO(msgType)); switch (msgType) { case TDMT_DND_ALTER_MNODE: -- GitLab