git: 92d579a9ae19 - stable/13 - ocs_fc: Fix memory leak in ocs_scsi_io_alloc()

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

URL: https://cgit.FreeBSD.org/src/commit/?id=92d579a9ae192605fe820ff64a6f889e2014e245

commit 92d579a9ae192605fe820ff64a6f889e2014e245
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 10:11:49 +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 c2df898bda4b..b1d98c7c0e3d 100644
--- a/sys/dev/ocs_fc/ocs_scsi.c
+++ b/sys/dev/ocs_fc/ocs_scsi.c
@@ -201,6 +201,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;
 		}