Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 2009 15:27:01 +0000 (UTC)
From:      Alexander Leidinger <netchild@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r199582 - head/sbin/fsck
Message-ID:  <200911201527.nAKFR1RS047805@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: netchild
Date: Fri Nov 20 15:27:00 2009
New Revision: 199582
URL: http://svn.freebsd.org/changeset/base/199582

Log:
  Fix minor resource leak in a function which was introduced by changing an
  err() to a return in r106254.
  
  MFC after:	1 week

Modified:
  head/sbin/fsck/fsck.c

Modified: head/sbin/fsck/fsck.c
==============================================================================
--- head/sbin/fsck/fsck.c	Fri Nov 20 14:50:03 2009	(r199581)
+++ head/sbin/fsck/fsck.c	Fri Nov 20 15:27:00 2009	(r199582)
@@ -543,8 +543,10 @@ getfslab(const char *str)
 	if ((fd = open(str, O_RDONLY)) == -1)
 		err(1, "cannot open `%s'", str);
 
-	if (ioctl(fd, DIOCGDINFO, &dl) == -1)
+	if (ioctl(fd, DIOCGDINFO, &dl) == -1) {
+		(void) close(fd);
 		return(NULL);
+	}
 
 	(void) close(fd);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911201527.nAKFR1RS047805>