Created attachment 223742 [details]
The memory leak issue happens in one error handling path of ocs_scsi_io_alloc(). When `io->hio != NULL`, the function forgets to release the "io" allocated by ocs_io_alloc(), causing a memory leak.
Fix this issue by calling ocs_io_free() when `io->hio != NULL`. The attached patch is generated using Git on the latest version of FreeBSD.
Thanks for the patch. The patch looks good.
A commit in branch main references this bug:
Author: Ram Kishore Vegesna <ram@FreeBSD.org>
AuthorDate: 2021-04-19 15:40:59 +0000
Commit: Ram Kishore Vegesna <ram@FreeBSD.org>
CommitDate: 2021-04-22 12:18:37 +0000
ocs_fc: Fix memory leak in ocs_scsi_io_alloc()
Approved by: mav(mentor)
MFC after: 2 weeks
sys/dev/ocs_fc/ocs_scsi.c | 1 +
1 file changed, 1 insertion(+)