[BUG.FIX] fix init table store core dump.
This commit is contained in:
parent
645abea311
commit
4e05d2f634
@ -159,13 +159,13 @@ int ObSSTableArray::inner_init(
|
||||
cnt_ = 0;
|
||||
sstable_array_ = nullptr;
|
||||
} else {
|
||||
cnt_ = count;
|
||||
sstable_array_ = static_cast<ObSSTable **>(allocator.alloc(sizeof(ObSSTable *) * cnt_));
|
||||
sstable_array_ = static_cast<ObSSTable **>(allocator.alloc(sizeof(ObSSTable *) * count));
|
||||
if (OB_ISNULL(sstable_array_)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to allocate memory for sstable address array", K(ret), K_(cnt));
|
||||
}
|
||||
for (int64_t i = start_pos; OB_SUCC(ret) && i < start_pos + count; ++i) {
|
||||
int64_t i = start_pos;
|
||||
for (; OB_SUCC(ret) && i < start_pos + count; ++i) {
|
||||
ObITable *table = tables.at(i);
|
||||
if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -178,10 +178,16 @@ int ObSSTableArray::inner_init(
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
for (int64_t j = i - 2; j >= start_pos; --j) {
|
||||
sstable_array_[j]->~ObSSTable();
|
||||
sstable_array_[j] = nullptr;
|
||||
}
|
||||
if (nullptr != sstable_array_) {
|
||||
allocator.free(sstable_array_);
|
||||
sstable_array_ = nullptr;
|
||||
}
|
||||
} else {
|
||||
cnt_ = count;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user