Module Name:    src
Committed By:   mlelstv
Date:           Thu Jan  5 16:35:33 UTC 2017

Modified Files:
        src/sys/dev/scsipi: cd.c

Log Message:
Fix memory leak.

Found by maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.338 -r1.339 src/sys/dev/scsipi/cd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.338 src/sys/dev/scsipi/cd.c:1.339
--- src/sys/dev/scsipi/cd.c:1.338	Wed Dec 21 21:28:30 2016
+++ src/sys/dev/scsipi/cd.c	Thu Jan  5 16:35:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.338 2016/12/21 21:28:30 mlelstv Exp $	*/
+/*	$NetBSD: cd.c,v 1.339 2017/01/05 16:35:33 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.338 2016/12/21 21:28:30 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.339 2017/01/05 16:35:33 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2815,11 +2815,11 @@ mmc_getdiscinfo(struct scsipi_periph *pe
 	if (error) {
 		/* discinfo call failed, emulate for cd-rom/dvd-rom */
 		if (mmc_discinfo->mmc_profile == 0x08) /* CD-ROM */
-			return mmc_getdiscinfo_cdrom(periph, mmc_discinfo);
-		if (mmc_discinfo->mmc_profile == 0x10) /* DVD-ROM */
-			return mmc_getdiscinfo_dvdrom(periph, mmc_discinfo);
-		/* CD/DVD drive is violating specs */
-		error = EIO;
+			error = mmc_getdiscinfo_cdrom(periph, mmc_discinfo);
+		else if (mmc_discinfo->mmc_profile == 0x10) /* DVD-ROM */
+			error = mmc_getdiscinfo_dvdrom(periph, mmc_discinfo);
+		else /* CD/DVD drive is violating specs */
+			error = EIO;
 		goto out;
 	}
 

Reply via email to