ctl ramdisk: Free compare buffer after a compare I/O request.

For a compare request, the ramdisk backend allocates a temporary
buffer to hold the I/O data and then compares it against the LUN's
pages in ctl_backend_ramdisk_cmp after the data has been filled.
However, the tempory buffer was leaked when after the comparison was
complete.  Fix this by freeing the buffer after the comparison.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D34316
This commit is contained in:
John Baldwin 2022-02-18 15:20:14 -08:00
parent 39d8c38707
commit bd6e8729d6

View File

@ -386,6 +386,7 @@ ctl_backend_ramdisk_cmp(union ctl_io *io)
if (res < cbe_lun->blocksize)
break;
}
free(io->scsiio.kern_data_ptr, M_RAMDISK);
if (lbas > 0) {
off += io->scsiio.kern_rel_offset - io->scsiio.kern_data_len;
scsi_u64to8b(off, info);