summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}