fix: pSchemaExt crash
This commit is contained in:
parent
c9415f5f85
commit
5f582723eb
|
@ -1539,7 +1539,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
|
|||
if (output->tbMeta) {
|
||||
int32_t metaSize = CTG_META_SIZE(output->tbMeta);
|
||||
int32_t schemaExtSize = 0;
|
||||
if (useCompress(output->ctbMeta.tableType)) {
|
||||
if (useCompress(output->tbMeta->tableType) && (*pOutput)->tbMeta->schemaExt) {
|
||||
schemaExtSize = output->tbMeta->tableInfo.numOfColumns * sizeof(SSchemaExt);
|
||||
}
|
||||
(*pOutput)->tbMeta = taosMemoryMalloc(metaSize + schemaExtSize);
|
||||
|
@ -1551,7 +1551,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
|
|||
}
|
||||
|
||||
memcpy((*pOutput)->tbMeta, output->tbMeta, metaSize);
|
||||
if (useCompress(output->ctbMeta.tableType)) {
|
||||
if (useCompress(output->tbMeta->tableType) && (*pOutput)->tbMeta->schemaExt) {
|
||||
(*pOutput)->tbMeta->schemaExt = (SSchemaExt *)((char *)(*pOutput)->tbMeta + metaSize);
|
||||
memcpy((*pOutput)->tbMeta->schemaExt, output->tbMeta->schemaExt, schemaExtSize);
|
||||
} else {
|
||||
|
|
|
@ -1225,7 +1225,7 @@ STableCfg* tableCfgDup(STableCfg* pCfg) {
|
|||
SSchema* pSchema = taosMemoryMalloc(schemaSize);
|
||||
memcpy(pSchema, pCfg->pSchemas, schemaSize);
|
||||
SSchemaExt* pSchemaExt = NULL;
|
||||
if (useCompress(pCfg->tableType)) {
|
||||
if (useCompress(pCfg->tableType) && pCfg->pSchemaExt) {
|
||||
int32_t schemaExtSize = pCfg->numOfColumns * sizeof(SSchemaExt);
|
||||
pSchemaExt = taosMemoryMalloc(schemaExtSize);
|
||||
memcpy(pSchemaExt, pCfg->pSchemaExt, schemaExtSize);
|
||||
|
|
|
@ -482,7 +482,7 @@ int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) {
|
|||
|
||||
int32_t metaSize = sizeof(STableMeta) + numOfField * sizeof(SSchema);
|
||||
int32_t schemaExtSize = 0;
|
||||
if (useCompress(pSrc->tableType)) {
|
||||
if (useCompress(pSrc->tableType) && pSrc->schemaExt) {
|
||||
schemaExtSize = pSrc->tableInfo.numOfColumns * sizeof(SSchemaExt);
|
||||
}
|
||||
*pDst = taosMemoryMalloc(metaSize + schemaExtSize);
|
||||
|
|
|
@ -454,7 +454,7 @@ int32_t queryCreateCTableMetaFromMsg(STableMetaRsp *msg, SCTableMeta *pMeta) {
|
|||
int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta **pMeta) {
|
||||
int32_t total = msg->numOfColumns + msg->numOfTags;
|
||||
int32_t metaSize = sizeof(STableMeta) + sizeof(SSchema) * total;
|
||||
int32_t schemaExtSize = useCompress(msg->tableType) ? sizeof(SSchemaExt) * msg->numOfColumns : 0;
|
||||
int32_t schemaExtSize = (useCompress(msg->tableType) && msg->pSchemaExt) ? sizeof(SSchemaExt) * msg->numOfColumns : 0;
|
||||
|
||||
STableMeta *pTableMeta = taosMemoryCalloc(1, metaSize + schemaExtSize);
|
||||
if (NULL == pTableMeta) {
|
||||
|
@ -475,7 +475,7 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta *
|
|||
pTableMeta->tableInfo.numOfColumns = msg->numOfColumns;
|
||||
|
||||
memcpy(pTableMeta->schema, msg->pSchemas, sizeof(SSchema) * total);
|
||||
if (useCompress(msg->tableType)) {
|
||||
if (useCompress(msg->tableType) && msg->pSchemaExt) {
|
||||
pTableMeta->schemaExt = pSchemaExt;
|
||||
memcpy(pSchemaExt, msg->pSchemaExt, schemaExtSize);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue