From 97bd6a9f9212abc5a4c45e1b5f4e66b0744033f9 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 4 Aug 2021 00:18:10 +0800 Subject: [PATCH] [TD-5694]: fix memory alloc --- src/common/src/tdataformat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index c96c916a01..16c96bb16f 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -371,6 +371,11 @@ int tdInitDataCols(SDataCols *pCols, STSchema *pSchema) { pCols->cols = (SDataCol *)realloc(pCols->cols, sizeof(SDataCol) * pCols->maxCols); if (pCols->cols == NULL) return -1; } + for(i = 0; i < pCols->maxCols; i++) { + tfree(pCols->cols[i].pData); + pCols->cols[i].dataOff = NULL; + pCols->cols[i].spaceSize = 0; + } if (schemaTLen(pSchema) > pCols->maxRowSize) { pCols->maxRowSize = schemaTLen(pSchema);