lib/nfs/FileReader: clear the read_buffer in CancelRead()

Fixes assertion failure with libnfs 6.
This commit is contained in:
Max Kellermann 2024-05-16 13:58:56 +02:00
parent 1d35031024
commit 58e3b830e9
1 changed files with 8 additions and 1 deletions

View File

@ -138,7 +138,14 @@ void
NfsFileReader::CancelRead() noexcept
{
if (state == State::READ) {
connection->Cancel(*this, nullptr, {});
DisposablePointer dispose_value{};
#ifdef LIBNFS_API_2
assert(read_buffer);
dispose_value = ToDeleteArray(read_buffer.release());
#endif
connection->Cancel(*this, nullptr, std::move(dispose_value));
state = State::IDLE;
}
}