Resent-Date: Thu, 17 Dec 1998 11:14:34 +0100 (MET)
To: Jes Sorensen <Jes.Sorensen@cern.ch>
Cc: linux-m68k@lists.linux-m68k.org
Subject: Re: 2.1.131
References: <199812161730.SAA16432@valhall.cern.ch>
X-Yow: YOU!!  Give me the CUTEST, PINKEST, most charming little
 VICTORIAN DOLLHOUSE you can find!!  An make it SNAPPY!!
From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Date: 17 Dec 1998 11:14:29 +0100
In-Reply-To: Jes Sorensen's message of "Wed, 16 Dec 1998 18:30:57 +0100 (MET)"
Resent-From: linux-m68k@phil.uni-sb.de

Jes Sorensen <Jes.Sorensen@cern.ch> writes:

|> Send complaints to /dev/null and nice christmas presents to me instead
|> ;-)

Ok, here is one (a present, that is :-).  It removes a resource leak after
`rmdir foo' if foo does not exist.

--- linux/fs/namei.c.~1~	Thu Dec 17 11:05:10 1998
+++ linux/fs/namei.c	Thu Dec 17 11:13:12 1998
@@ -876,11 +876,14 @@
 	if (IS_ERR(dentry))
 		goto exit;
 
-	dir = dget(dentry->d_parent);
-
 	error = -ENOENT;
-	if (!dentry->d_inode)
+	if (!dentry->d_inode) {
+		dput(dentry);
 		goto exit;
+	}
+
+	dir = dget(dentry->d_parent);
+
 	/*
 	 * The dentry->d_count stuff confuses d_delete() enough to
 	 * not kill the inode from under us while it is locked. This

Andreas.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org

