fix(tsdb/cache): Not free zero length var data
This commit is contained in:
parent
ee9c59dc77
commit
8ec5df8d7d
|
@ -279,7 +279,8 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST
|
||||||
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
||||||
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
||||||
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
||||||
taosMemoryFree(pLastCol->colVal.value.pData);
|
if (pLastCol->colVal.value.nData > 0 && NULL != pLastCol->colVal.value.pData)
|
||||||
|
taosMemoryFree(pLastCol->colVal.value.pData);
|
||||||
|
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (lastCol.colVal.value.pData == NULL) {
|
||||||
|
@ -361,7 +362,8 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row, STsdb
|
||||||
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
||||||
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
||||||
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
||||||
taosMemoryFree(pLastCol->colVal.value.pData);
|
if (pLastCol->colVal.value.nData > 0 && NULL != pLastCol->colVal.value.pData)
|
||||||
|
taosMemoryFree(pLastCol->colVal.value.pData);
|
||||||
|
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (lastCol.colVal.value.pData == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue