Browse Source

[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>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
0654698cd7
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      src/net/fcp.c

+ 2
- 0
src/net/fcp.c View File

@@ -794,6 +794,7 @@ static int fcpdev_scsi_command ( struct fcp_device *fcpdev,
794 794
 
795 795
  err_xchg_originate:
796 796
 	fcpcmd_close ( fcpcmd, rc );
797
+	ref_put ( &fcpcmd->refcnt );
797 798
  err_zalloc:
798 799
  err_target:
799 800
  err_link:
@@ -979,6 +980,7 @@ static int fcpdev_open ( struct interface *parent, struct fc_name *wwn,
979 980
 
980 981
  err_scsi_open:
981 982
 	fcpdev_close ( fcpdev, rc );
983
+	ref_put ( &fcpdev->refcnt );
982 984
  err_zalloc:
983 985
 	fc_ulp_put ( ulp );
984 986
  err_ulp_get:

Loading…
Cancel
Save