summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-10-11 02:50:49 +0000
committerMiles Bader <miles@gnu.org>1996-10-11 02:50:49 +0000
commit0025e6fb78af4c9722828e233564e27513cae110 (patch)
tree2bebaaa8a42b99dd7c2a40556bb399b020ca4d4a
parent83901da54038ac9e2ac956ea178b2a6d2f03cbbc (diff)
(diskfs_S_dir_lookup):
Free NEWPI if we get an error trying to lock it.
-rw-r--r--libdiskfs/dir-lookup.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index cba6347d..fa4db753 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -415,9 +415,11 @@ diskfs_S_dir_lookup (struct protid *dircred,
else if (flags & O_SHLOCK)
error = fshelp_acquire_lock (&np->userlock, &newpi->po->lock_status,
&np->lock, LOCK_SH);
+ if (error)
+ ports_port_deref (newpi); /* Get rid of NEWPI. */
}
- if (!error)
+ if (! error)
{
*returned_port = ports_get_right (newpi);
ports_port_deref (newpi);
@@ -425,13 +427,12 @@ diskfs_S_dir_lookup (struct protid *dircred,
out:
if (np)
- {
- if (dnp == np)
- diskfs_nrele (np);
- else
- diskfs_nput (np);
- }
+ if (dnp == np)
+ diskfs_nrele (np);
+ else
+ diskfs_nput (np);
if (dnp)
diskfs_nput (dnp);
+
return error;
}