提交 0ec07172 编写于 作者: X Xiaoyu Wang

fix: invild free

上级 69022a1c
...@@ -62,8 +62,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp ...@@ -62,8 +62,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp
pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock); pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock);
pEntry->dataLen = sizeof(SDeleterRes); pEntry->dataLen = sizeof(SDeleterRes);
// ASSERT(1 == pEntry->numOfRows); // ASSERT(1 == pEntry->numOfRows);
// ASSERT(3 == pEntry->numOfCols); // ASSERT(3 == pEntry->numOfCols);
pBuf->useSize = sizeof(SDataCacheEntry); pBuf->useSize = sizeof(SDataCacheEntry);
...@@ -142,7 +142,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, ...@@ -142,7 +142,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
taosFreeQitem(pBuf); taosFreeQitem(pBuf);
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
toDataCacheEntry(pDeleter, pInput, pBuf); toDataCacheEntry(pDeleter, pInput, pBuf);
taosWriteQitem(pDeleter->pDataBlocks, pBuf); taosWriteQitem(pDeleter->pDataBlocks, pBuf);
*pContinue = (DS_BUF_LOW == updateStatus(pDeleter) ? true : false); *pContinue = (DS_BUF_LOW == updateStatus(pDeleter) ? true : false);
...@@ -167,8 +167,10 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE ...@@ -167,8 +167,10 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE
SDataDeleterBuf* pBuf = NULL; SDataDeleterBuf* pBuf = NULL;
taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf); taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf);
memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf)); if (pBuf != NULL) {
taosFreeQitem(pBuf); memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf));
taosFreeQitem(pBuf);
}
SDataCacheEntry* pEntry = (SDataCacheEntry*)pDeleter->nextOutput.pData; SDataCacheEntry* pEntry = (SDataCacheEntry*)pDeleter->nextOutput.pData;
*pLen = pEntry->dataLen; *pLen = pEntry->dataLen;
...@@ -256,7 +258,7 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData ...@@ -256,7 +258,7 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData
deleter->pDeleter = pDeleterNode; deleter->pDeleter = pDeleterNode;
deleter->pSchema = pDataSink->pInputDataBlockDesc; deleter->pSchema = pDataSink->pInputDataBlockDesc;
if(pParam == NULL) { if (pParam == NULL) {
code = TSDB_CODE_QRY_INVALID_INPUT; code = TSDB_CODE_QRY_INVALID_INPUT;
qError("invalid input param in creating data deleter, code%s", tstrerror(code)); qError("invalid input param in creating data deleter, code%s", tstrerror(code));
goto _end; goto _end;
...@@ -275,7 +277,7 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData ...@@ -275,7 +277,7 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData
*pHandle = deleter; *pHandle = deleter;
return code; return code;
_end: _end:
if (deleter != NULL) { if (deleter != NULL) {
destroyDataSinker((SDataSinkHandle*)deleter); destroyDataSinker((SDataSinkHandle*)deleter);
taosMemoryFree(deleter); taosMemoryFree(deleter);
......
...@@ -3517,7 +3517,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS ...@@ -3517,7 +3517,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
if (comp > 0) { if (comp > 0) {
SNode* pRightFunc = NULL; SNode* pRightFunc = NULL;
int32_t code = createCastFunc(pCxt, pRight, pLeftExpr->resType, &pRightFunc); int32_t code = createCastFunc(pCxt, pRight, pLeftExpr->resType, &pRightFunc);
if (TSDB_CODE_SUCCESS != code || NULL == pRightFunc) { // deal scan coverity if (TSDB_CODE_SUCCESS != code || NULL == pRightFunc) { // deal scan coverity
return code; return code;
} }
REPLACE_LIST2_NODE(pRightFunc); REPLACE_LIST2_NODE(pRightFunc);
...@@ -3525,7 +3525,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS ...@@ -3525,7 +3525,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
} else if (comp < 0) { } else if (comp < 0) {
SNode* pLeftFunc = NULL; SNode* pLeftFunc = NULL;
int32_t code = createCastFunc(pCxt, pLeft, pRightExpr->resType, &pLeftFunc); int32_t code = createCastFunc(pCxt, pLeft, pRightExpr->resType, &pLeftFunc);
if (TSDB_CODE_SUCCESS != code || NULL == pLeftFunc) { // deal scan coverity if (TSDB_CODE_SUCCESS != code || NULL == pLeftFunc) { // deal scan coverity
return code; return code;
} }
REPLACE_LIST1_NODE(pLeftFunc); REPLACE_LIST1_NODE(pLeftFunc);
...@@ -5809,7 +5809,7 @@ static int32_t projColPosCompar(const void* l, const void* r) { ...@@ -5809,7 +5809,7 @@ static int32_t projColPosCompar(const void* l, const void* r) {
return ((SProjColPos*)l)->colId > ((SProjColPos*)r)->colId; return ((SProjColPos*)l)->colId > ((SProjColPos*)r)->colId;
} }
static void projColPosDelete(void* p) { taosMemoryFree(((SProjColPos*)p)->pProj); } static void projColPosDelete(void* p) { nodesDestroyNode(((SProjColPos*)p)->pProj); }
static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSchema, SNode* pProj, SArray* pProjColPos) { static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSchema, SNode* pProj, SArray* pProjColPos) {
SNode* pNewProj = nodesCloneNode(pProj); SNode* pNewProj = nodesCloneNode(pProj);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册