Merge pull request #27596 from taosdata/fix/TD-31826
fix: cache value double free issue
This commit is contained in:
commit
4e239a5b76
|
@ -744,9 +744,7 @@ _end:
|
|||
insertRet = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(uint64_t), pVal,
|
||||
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
if (insertRet != TAOS_LRU_STATUS_OK) {
|
||||
qError("failed to put meta into lru cache, code:%d, %s", insertRet, idStr);
|
||||
taosMemoryFreeClear(pVal);
|
||||
freeTableCachedValObj(&val);
|
||||
qWarn("failed to put meta into lru cache, code:%d, %s", insertRet, idStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -445,6 +445,9 @@ static LRUStatus taosLRUCacheShardInsert(SLRUCacheShard *shard, const void *key,
|
|||
LRUPriority priority, void *ud) {
|
||||
SLRUEntry *e = taosMemoryCalloc(1, sizeof(SLRUEntry) - 1 + keyLen);
|
||||
if (!e) {
|
||||
if (deleter) {
|
||||
(*deleter)(key, keyLen, value, ud);
|
||||
}
|
||||
return TAOS_LRU_STATUS_FAIL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue