From 0025e6fb78af4c9722828e233564e27513cae110 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 11 Oct 1996 02:50:49 +0000 Subject: (diskfs_S_dir_lookup): Free NEWPI if we get an error trying to lock it. --- libdiskfs/dir-lookup.c | 15 ++++++++------- 1 file 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; } -- cgit v1.2.3