fix realloc usage in tdataformat
This commit is contained in:
parent
9e2188b196
commit
c3413fd830
|
@ -357,8 +357,9 @@ int tdInitDataCols(SDataCols *pCols, STSchema *pSchema) {
|
||||||
int oldMaxCols = pCols->maxCols;
|
int oldMaxCols = pCols->maxCols;
|
||||||
if (schemaNCols(pSchema) > oldMaxCols) {
|
if (schemaNCols(pSchema) > oldMaxCols) {
|
||||||
pCols->maxCols = schemaNCols(pSchema);
|
pCols->maxCols = schemaNCols(pSchema);
|
||||||
pCols->cols = (SDataCol *)realloc(pCols->cols, sizeof(SDataCol) * pCols->maxCols);
|
void* ptr = (SDataCol *)realloc(pCols->cols, sizeof(SDataCol) * pCols->maxCols);
|
||||||
if (pCols->cols == NULL) return -1;
|
if (ptr == NULL) return -1;
|
||||||
|
pCols->cols = ptr;
|
||||||
for(i = oldMaxCols; i < pCols->maxCols; i++) {
|
for(i = oldMaxCols; i < pCols->maxCols; i++) {
|
||||||
pCols->cols[i].pData = NULL;
|
pCols->cols[i].pData = NULL;
|
||||||
pCols->cols[i].dataOff = NULL;
|
pCols->cols[i].dataOff = NULL;
|
||||||
|
|
Loading…
Reference in New Issue