[td-11818] Fix memory leak.
This commit is contained in:
parent
0f9d860d4e
commit
1f16647c97
|
@ -91,17 +91,19 @@ int32_t qCreateQueryDag(const struct SQueryNode* pNode, struct SQueryDag** pDag,
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void extractResSchema(struct SQueryDag* const* pDag, SSchema** pResSchema,
|
// extract the final result schema
|
||||||
int32_t* numOfCols) { // extract the final result schema
|
void extractResSchema(struct SQueryDag* const* pDag, SSchema** pResSchema, int32_t* numOfCols) {
|
||||||
SArray* pTopSubplan = taosArrayGetP((*pDag)->pSubplans, 0);
|
SArray* pTopSubplan = taosArrayGetP((*pDag)->pSubplans, 0);
|
||||||
|
|
||||||
SSubplan* pPlan = taosArrayGetP(pTopSubplan, 0);
|
SSubplan* pPlan = taosArrayGetP(pTopSubplan, 0);
|
||||||
SDataBlockSchema* pDataBlockSchema = &(pPlan->pDataSink->schema);
|
SDataBlockSchema* pDataBlockSchema = &(pPlan->pDataSink->schema);
|
||||||
|
|
||||||
*numOfCols = pDataBlockSchema->numOfCols;
|
*numOfCols = pDataBlockSchema->numOfCols;
|
||||||
|
if (*numOfCols > 0) {
|
||||||
*pResSchema = calloc(pDataBlockSchema->numOfCols, sizeof(SSchema));
|
*pResSchema = calloc(pDataBlockSchema->numOfCols, sizeof(SSchema));
|
||||||
memcpy((*pResSchema), pDataBlockSchema->pSchema, pDataBlockSchema->numOfCols * sizeof(SSchema));
|
memcpy((*pResSchema), pDataBlockSchema->pSchema, pDataBlockSchema->numOfCols * sizeof(SSchema));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void qSetSubplanExecutionNode(SSubplan* subplan, uint64_t templateId, SDownstreamSource* pSource) {
|
void qSetSubplanExecutionNode(SSubplan* subplan, uint64_t templateId, SDownstreamSource* pSource) {
|
||||||
setSubplanExecutionNode(subplan, templateId, pSource);
|
setSubplanExecutionNode(subplan, templateId, pSource);
|
||||||
|
|
Loading…
Reference in New Issue