From aab502f2710971df305697a25382e29ccae6ad52 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 8 Jun 2020 09:25:48 +0000 Subject: [PATCH] TD-545 --- src/tsdb/src/tsdbMeta.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 820d2df888..40e5667893 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -74,14 +74,16 @@ void tsdbEncodeTable(STable *pTable, char *buf, int *contLen) { STable *tsdbDecodeTable(void *cont, int contLen) { STable *pTable = (STable *)calloc(1, sizeof(STable)); if (pTable == NULL) return NULL; - pTable->schema = (STSchema **)malloc(sizeof(STSchema *) * TSDB_MAX_TABLE_SCHEMAS); - if (pTable->schema == NULL) { - free(pTable); - return NULL; - } void *ptr = cont; T_READ_MEMBER(ptr, int8_t, pTable->type); + if (pTable->type != TSDB_CHILD_TABLE) { + pTable->schema = (STSchema **)malloc(sizeof(STSchema *) * TSDB_MAX_TABLE_SCHEMAS); + if (pTable->schema == NULL) { + free(pTable); + return NULL; + } + } int len = *(int *)ptr; ptr = (char *)ptr + sizeof(int); pTable->name = calloc(1, len + VARSTR_HEADER_SIZE + 1); -- GitLab