disk/virtual: Fix use after free

Pointed out by cppcheck.

Change-Id: I785b7ee5623ac9fb37f2be0b9a75cdd82b5784fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7257
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Murai Takashi
2023-12-28 14:47:43 +00:00
committed by Fredrik Holmqvist
parent 4c07199d82
commit 8a0910dd49
@@ -558,9 +558,10 @@ virtio_block_init_driver(device_node *node, void **cookie)
B_ANY_KERNEL_BLOCK_ADDRESS, B_PAGE_SIZE,
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if (info->bufferArea < B_OK) {
status_t status = info->bufferArea;
delete info->dma_resource;
free(info);
return info->bufferArea;
return status;
}
physical_entry entry;