fix part of memory leak
This commit is contained in:
parent
5c6cadceb4
commit
ead1a3101a
|
@ -111,11 +111,13 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
dTrace("pVnode:%p vgId:%d, table:%s, start to create", pVnode, pVnode->vgId, pTable->tableId);
|
dTrace("pVnode:%p vgId:%d, table:%s, start to create", pVnode, pVnode->vgId, pTable->tableId);
|
||||||
int16_t numOfColumns = htons(pTable->numOfColumns);
|
int16_t numOfColumns = htons(pTable->numOfColumns);
|
||||||
int16_t numOfTags = htons(pTable->numOfTags);
|
int16_t numOfTags = htons(pTable->numOfTags);
|
||||||
int32_t sid = htonl(pTable->sid);
|
int32_t sid = htonl(pTable->sid);
|
||||||
uint64_t uid = htobe64(pTable->uid);
|
uint64_t uid = htobe64(pTable->uid);
|
||||||
SSchema *pSchema = (SSchema *) pTable->data;
|
SSchema * pSchema = (SSchema *)pTable->data;
|
||||||
|
STSchema *pDestTagSchema = NULL;
|
||||||
|
SDataRow dataRow = NULL;
|
||||||
|
|
||||||
int32_t totalCols = numOfColumns + numOfTags;
|
int32_t totalCols = numOfColumns + numOfTags;
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
|
||||||
tsdbTableSetName(&tCfg, pTable->tableId, false);
|
tsdbTableSetName(&tCfg, pTable->tableId, false);
|
||||||
|
|
||||||
if (numOfTags != 0) {
|
if (numOfTags != 0) {
|
||||||
STSchema *pDestTagSchema = tdNewSchema(numOfTags);
|
pDestTagSchema = tdNewSchema(numOfTags);
|
||||||
for (int i = numOfColumns; i < totalCols; i++) {
|
for (int i = numOfColumns; i < totalCols; i++) {
|
||||||
tdSchemaAddCol(pDestTagSchema, pSchema[i].type, htons(pSchema[i].colId), htons(pSchema[i].bytes));
|
tdSchemaAddCol(pDestTagSchema, pSchema[i].type, htons(pSchema[i].colId), htons(pSchema[i].bytes));
|
||||||
}
|
}
|
||||||
|
@ -139,7 +141,7 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
|
||||||
|
|
||||||
char *pTagData = pTable->data + totalCols * sizeof(SSchema);
|
char *pTagData = pTable->data + totalCols * sizeof(SSchema);
|
||||||
int accumBytes = 0;
|
int accumBytes = 0;
|
||||||
SDataRow dataRow = tdNewDataRowFromSchema(pDestTagSchema);
|
dataRow = tdNewDataRowFromSchema(pDestTagSchema);
|
||||||
|
|
||||||
for (int i = 0; i < numOfTags; i++) {
|
for (int i = 0; i < numOfTags; i++) {
|
||||||
STColumn *pTCol = schemaColAt(pDestTagSchema, i);
|
STColumn *pTCol = schemaColAt(pDestTagSchema, i);
|
||||||
|
@ -150,6 +152,8 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tsdbCreateTable(pVnode->tsdb, &tCfg);
|
code = tsdbCreateTable(pVnode->tsdb, &tCfg);
|
||||||
|
tdFreeDataRow(dataRow);
|
||||||
|
tfree(pDestTagSchema);
|
||||||
tfree(pDestSchema);
|
tfree(pDestSchema);
|
||||||
|
|
||||||
dTrace("pVnode:%p vgId:%d, table:%s is created, result:%x", pVnode, pVnode->vgId, pTable->tableId, code);
|
dTrace("pVnode:%p vgId:%d, table:%s is created, result:%x", pVnode, pVnode->vgId, pTable->tableId, code);
|
||||||
|
|
Loading…
Reference in New Issue