Fix nullptr deref

This commit is contained in:
Amos Bird 2022-09-19 14:07:31 +08:00
parent d5fae3d16b
commit 09b75901f0
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4

View File

@ -82,6 +82,9 @@ private:
ReservationPtr reserve(uint64_t bytes)
{
ReservationPtr reservation = disk->reserve(bytes);
if (!reservation)
return {};
/// Not just subtract bytes, but update the value,
/// since some reservations may be done directly via IDisk, or not by ClickHouse.
free_size = reservation->getUnreservedSpace();