Module Name:    src
Committed By:   christos
Date:           Sat Dec 29 21:57:13 UTC 2012

Modified Files:
        src/sys/arch/x86/x86: x86_autoconf.c

Log Message:
don't leak a vnode on error


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x86/x86/x86_autoconf.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/arch/x86/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.65 src/sys/arch/x86/x86/x86_autoconf.c:1.66
--- src/sys/arch/x86/x86/x86_autoconf.c:1.65	Sun Jul 29 14:05:47 2012
+++ src/sys/arch/x86/x86/x86_autoconf.c	Sat Dec 29 16:57:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_autoconf.c,v 1.65 2012/07/29 18:05:47 mlelstv Exp $	*/
+/*	$NetBSD: x86_autoconf.c,v 1.66 2012/12/29 21:57:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.65 2012/07/29 18:05:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.66 2012/12/29 21:57:13 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -155,6 +155,7 @@ matchbiosdisks(void)
 			error = vn_rdwr(UIO_READ, tv, mbr, DEV_BSIZE, 0,
 			    UIO_SYSSPACE, 0, NOCRED, NULL, NULL);
 			VOP_CLOSE(tv, FREAD, NOCRED);
+			vput(tv);
 			if (error) {
 #ifdef GEOM_DEBUG
 				printf("matchbiosdisks: %s: MBR read failure\n",
@@ -187,7 +188,6 @@ matchbiosdisks(void)
 				}
 			}
 			x86_alldisks->dl_nativedisks[n].ni_nmatches = m;
-			vput(tv);
 		}
 	}
 	deviter_release(&di);

Reply via email to