summaryrefslogtreecommitdiffstats
path: root/src/net/fcp.c
diff options
context:
space:
mode:
authorMichael Brown2010-11-03 02:48:38 +0100
committerMichael Brown2010-11-03 02:48:59 +0100
commit0654698cd72bfb265191fde908787028c3fd353e (patch)
tree66b32effd7978facf9c1e7bed721c658fefe812c /src/net/fcp.c
parent[build] Add FreeBSD location for isolinux (diff)
downloadipxe-0654698cd72bfb265191fde908787028c3fd353e.tar.gz
ipxe-0654698cd72bfb265191fde908787028c3fd353e.tar.xz
ipxe-0654698cd72bfb265191fde908787028c3fd353e.zip
[fcp] Fix potential memory leaks on error paths
Functions that instantiate objects generally own one reference to the object being created. The error paths must therefore usually call ref_put() to release this reference. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/fcp.c')
-rw-r--r--src/net/fcp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/net/fcp.c b/src/net/fcp.c
index 60a14cf5..ddb6ccc8 100644
--- a/src/net/fcp.c
+++ b/src/net/fcp.c
@@ -794,6 +794,7 @@ static int fcpdev_scsi_command ( struct fcp_device *fcpdev,
err_xchg_originate:
fcpcmd_close ( fcpcmd, rc );
+ ref_put ( &fcpcmd->refcnt );
err_zalloc:
err_target:
err_link:
@@ -979,6 +980,7 @@ static int fcpdev_open ( struct interface *parent, struct fc_name *wwn,
err_scsi_open:
fcpdev_close ( fcpdev, rc );
+ ref_put ( &fcpdev->refcnt );
err_zalloc:
fc_ulp_put ( ulp );
err_ulp_get: