fix(lru/init): free cache's shards if shard init failed
This commit is contained in:
parent
155d7548d6
commit
7adddf0fb6
|
@ -674,6 +674,7 @@ SLRUCache *taosLRUCacheInit(size_t capacity, int numShardBits, double highPriPoo
|
||||||
for (int i = 0; i < numShards; ++i) {
|
for (int i = 0; i < numShards; ++i) {
|
||||||
if (TSDB_CODE_SUCCESS !=
|
if (TSDB_CODE_SUCCESS !=
|
||||||
taosLRUCacheShardInit(&cache->shards[i], perShard, strictCapacity, highPriPoolRatio, 32 - numShardBits)) {
|
taosLRUCacheShardInit(&cache->shards[i], perShard, strictCapacity, highPriPoolRatio, 32 - numShardBits)) {
|
||||||
|
taosMemoryFree(cache->shards);
|
||||||
taosMemoryFree(cache);
|
taosMemoryFree(cache);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue