fix:[TD-31511] Fix memory leak when error occurs.
This commit is contained in:
parent
28bcdd30a2
commit
2f92b80cd6
|
@ -2372,6 +2372,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t
|
||||||
}
|
}
|
||||||
gRes[gResIdx]->colInfo = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(SFilterColInfo));
|
gRes[gResIdx]->colInfo = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(SFilterColInfo));
|
||||||
if (gRes[gResIdx]->colInfo == NULL) {
|
if (gRes[gResIdx]->colInfo == NULL) {
|
||||||
|
filterFreeGroupCtx(gRes[gResIdx]);
|
||||||
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
colIdxi = 0;
|
colIdxi = 0;
|
||||||
|
@ -2384,6 +2385,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t
|
||||||
if (gRes[gResIdx]->colInfo[cidx].info == NULL) {
|
if (gRes[gResIdx]->colInfo[cidx].info == NULL) {
|
||||||
gRes[gResIdx]->colInfo[cidx].info = (SArray *)taosArrayInit(4, POINTER_BYTES);
|
gRes[gResIdx]->colInfo[cidx].info = (SArray *)taosArrayInit(4, POINTER_BYTES);
|
||||||
if (gRes[gResIdx]->colInfo[cidx].info == NULL) {
|
if (gRes[gResIdx]->colInfo[cidx].info == NULL) {
|
||||||
|
filterFreeGroupCtx(gRes[gResIdx]);
|
||||||
FLT_ERR_JRET(terrno);
|
FLT_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
colIdx[colIdxi++] = cidx;
|
colIdx[colIdxi++] = cidx;
|
||||||
|
@ -2408,7 +2410,11 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FLT_ERR_JRET(filterMergeUnits(info, gRes[gResIdx], colIdx[l], &empty));
|
code = filterMergeUnits(info, gRes[gResIdx], colIdx[l], &empty);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
filterFreeGroupCtx(gRes[gResIdx]);
|
||||||
|
SCL_ERR_JRET(code);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty) {
|
if (empty) {
|
||||||
break;
|
break;
|
||||||
|
@ -2426,10 +2432,9 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t
|
||||||
gRes[gResIdx]->colNum = colIdxi;
|
gRes[gResIdx]->colNum = colIdxi;
|
||||||
FILTER_COPY_IDX(&gRes[gResIdx]->colIdx, colIdx, colIdxi);
|
FILTER_COPY_IDX(&gRes[gResIdx]->colIdx, colIdx, colIdxi);
|
||||||
++gResIdx;
|
++gResIdx;
|
||||||
|
*gResNum = gResIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
*gResNum = gResIdx;
|
|
||||||
|
|
||||||
if (gResIdx == 0) {
|
if (gResIdx == 0) {
|
||||||
FILTER_SET_FLAG(info->status, FI_STATUS_EMPTY);
|
FILTER_SET_FLAG(info->status, FI_STATUS_EMPTY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue