fix invalid free
This commit is contained in:
parent
3843fa6de8
commit
dc63ec194d
|
@ -1320,8 +1320,6 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, &lino, _end);
|
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, &lino, _end);
|
||||||
}
|
}
|
||||||
|
|
||||||
QUEUE_INIT(&exh->q);
|
|
||||||
|
|
||||||
SExHandle* pSelf = transAcquireExHandle(uvGetConnRefOfThrd(pThrd), exh->refId);
|
SExHandle* pSelf = transAcquireExHandle(uvGetConnRefOfThrd(pThrd), exh->refId);
|
||||||
if (pSelf != exh) {
|
if (pSelf != exh) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _end);
|
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _end);
|
||||||
|
@ -1369,6 +1367,12 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
||||||
return pConn;
|
return pConn;
|
||||||
_end:
|
_end:
|
||||||
if (pConn) {
|
if (pConn) {
|
||||||
|
if (pConn->refId > 0) {
|
||||||
|
transReleaseExHandle(uvGetConnRefOfThrd(pThrd), pConn->refId);
|
||||||
|
transRemoveExHandle(uvGetConnRefOfThrd(pThrd), pConn->refId);
|
||||||
|
pConn->refId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
transQueueDestroy(&pConn->resps);
|
transQueueDestroy(&pConn->resps);
|
||||||
transDestroyBuffer(&pConn->readBuf);
|
transDestroyBuffer(&pConn->readBuf);
|
||||||
taosHashCleanup(pConn->pQTable);
|
taosHashCleanup(pConn->pQTable);
|
||||||
|
@ -1379,9 +1383,6 @@ _end:
|
||||||
pConn = NULL;
|
pConn = NULL;
|
||||||
}
|
}
|
||||||
tError("%s failed to create conn since %s", transLabel(pInst), tstrerror(code));
|
tError("%s failed to create conn since %s", transLabel(pInst), tstrerror(code));
|
||||||
return NULL;
|
|
||||||
_end2:
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue