git: 12e6cbd15853 - stable/12 - ocs_fc: Fix memory leak in ocs_scsi_io_alloc()

From: Ram Kishore Vegesna <ram_at_FreeBSD.org>
Date: Fri, 17 Dec 2021 10:03:45 UTC
The branch stable/12 has been updated by ram:

URL: https://cgit.FreeBSD.org/src/commit/?id=12e6cbd158530259d951e3e246a52ddc57fa644b

commit 12e6cbd158530259d951e3e246a52ddc57fa644b
Author:     Ram Kishore Vegesna <ram@FreeBSD.org>
AuthorDate: 2021-04-19 15:40:59 +0000
Commit:     Ram Kishore Vegesna <ram@FreeBSD.org>
CommitDate: 2021-12-17 09:45:59 +0000

    ocs_fc: Fix memory leak in ocs_scsi_io_alloc()
    
    PR: 254690
    Approved by: mav(mentor)
    MFC after: 2 weeks
    
    (cherry picked from commit fc620f9782d1fda5a243fd51a93a0fb46bc80f64)
---
 sys/dev/ocs_fc/ocs_scsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/ocs_fc/ocs_scsi.c b/sys/dev/ocs_fc/ocs_scsi.c
index dd1f15cb3877..b11d2678267c 100644
--- a/sys/dev/ocs_fc/ocs_scsi.c
+++ b/sys/dev/ocs_fc/ocs_scsi.c
@@ -203,6 +203,7 @@ ocs_scsi_io_alloc(ocs_node_t *node, ocs_scsi_io_role_e role)
 
 		if (io->hio != NULL) {
 			ocs_log_err(node->ocs, "assertion failed: io->hio is not NULL\n");
+			ocs_io_free(ocs, io);
 			ocs_unlock(&node->active_ios_lock);
 			return NULL;
 		}