Fix freeing of dyn_data and temp metadata block buffers on read cancel

A regression test would also be fun
This commit is contained in:
Vitaliy Filippov
2026-06-20 02:10:11 +03:00
parent 5e12b4a1a5
commit e373ea2163
+9 -12
View File
@@ -552,20 +552,17 @@ int blockstore_impl_t::dequeue_read(blockstore_op_t *read_op)
undo_read:
// need to wait. undo added requests, don't dequeue op
release_clean(read_op);
if (dsk.csum_block_size > dsk.bitmap_granularity)
for (auto & vec: rv)
{
for (auto & vec: rv)
if ((vec.copy_flags & COPY_BUF_CSUM_FILL) && vec.buf)
{
if ((vec.copy_flags & COPY_BUF_CSUM_FILL) && vec.buf)
{
free(vec.buf);
vec.buf = NULL;
}
if (vec.dyn_data && --(*vec.dyn_data) == 0) // refcount
{
free(vec.dyn_data);
vec.dyn_data = NULL;
}
free(vec.buf);
vec.buf = NULL;
}
if (vec.dyn_data && --(*vec.dyn_data) == 0) // refcount
{
free(vec.dyn_data);
vec.dyn_data = NULL;
}
}
rv.clear();