kern/138376: Memory leak in scsi_low_attach_xs() in file sys/cam/scsi/scsi_low.c

Patroklos Argyroudis argp at census-labs.com
Mon Aug 31 10:00:17 UTC 2009


>Number:         138376
>Category:       kern
>Synopsis:       Memory leak in scsi_low_attach_xs() in file sys/cam/scsi/scsi_low.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 31 10:00:15 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Patroklos Argyroudis
>Release:        8.0-CURRENT
>Organization:
census, inc
>Environment:
N/A
>Description:
Memory leak of pointer sap if the allocation in line 639 fails.
>How-To-Repeat:
N/A
>Fix:
Patch attached.

Patch attached with submission follows:

--- ./sys/cam/scsi/scsi_low.c.orig	2009-08-27 16:57:59.000000000 +0300
+++ ./sys/cam/scsi/scsi_low.c	2009-08-27 17:02:12.000000000 +0300
@@ -638,7 +638,10 @@
 		return ENOMEM;
 	splp = SCSI_LOW_MALLOC(sizeof(*splp));
 	if (splp == NULL)
+	{
+		SCSI_LOW_FREE(sap);
 		return ENOMEM;
+	}
 
 	SCSI_LOW_BZERO(sap, sizeof(*sap));
 	SCSI_LOW_BZERO(splp, sizeof(*splp));


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list