Fix arena allocation size in NewEmptyInternalIterator (#4905)
Summary: NewEmptyInternalIterator with arena mistakenly used EmptyIterator to allocate the size from area but then initialized it to a totally different object: EmptyInternalIterator. The patch fixes that. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4905 Differential Revision: D14689840 Pulled By: maysamyabandeh fbshipit-source-id: af64fd8ee93d5a4ad54691c792e5ecc5efabc887
This commit is contained in:
parent
a703f16da9
commit
127a850beb
@ -157,10 +157,6 @@ class EmptyInternalIterator : public InternalIteratorBase<TValue> {
|
|||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Iterator* NewEmptyIterator() {
|
|
||||||
return new EmptyIterator(Status::OK());
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator* NewErrorIterator(const Status& status) {
|
Iterator* NewErrorIterator(const Status& status) {
|
||||||
return new EmptyIterator(status);
|
return new EmptyIterator(status);
|
||||||
}
|
}
|
||||||
@ -180,7 +176,7 @@ InternalIteratorBase<TValue>* NewErrorInternalIterator(const Status& status,
|
|||||||
if (arena == nullptr) {
|
if (arena == nullptr) {
|
||||||
return NewErrorInternalIterator<TValue>(status);
|
return NewErrorInternalIterator<TValue>(status);
|
||||||
} else {
|
} else {
|
||||||
auto mem = arena->AllocateAligned(sizeof(EmptyIterator));
|
auto mem = arena->AllocateAligned(sizeof(EmptyInternalIterator<TValue>));
|
||||||
return new (mem) EmptyInternalIterator<TValue>(status);
|
return new (mem) EmptyInternalIterator<TValue>(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +197,7 @@ InternalIteratorBase<TValue>* NewEmptyInternalIterator(Arena* arena) {
|
|||||||
if (arena == nullptr) {
|
if (arena == nullptr) {
|
||||||
return NewEmptyInternalIterator<TValue>();
|
return NewEmptyInternalIterator<TValue>();
|
||||||
} else {
|
} else {
|
||||||
auto mem = arena->AllocateAligned(sizeof(EmptyIterator));
|
auto mem = arena->AllocateAligned(sizeof(EmptyInternalIterator<TValue>));
|
||||||
return new (mem) EmptyInternalIterator<TValue>(Status::OK());
|
return new (mem) EmptyInternalIterator<TValue>(Status::OK());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user