summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libnetfs/io-reauthenticate.c3
-rw-r--r--libtrivfs/io-reauthenticate.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/libnetfs/io-reauthenticate.c b/libnetfs/io-reauthenticate.c
index f4f50d52..91928130 100644
--- a/libnetfs/io-reauthenticate.c
+++ b/libnetfs/io-reauthenticate.c
@@ -43,7 +43,8 @@ netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port)
newright, 1);
pthread_mutex_lock (&user->po->np->lock);
- mach_port_deallocate (mach_task_self (), rend_port);
+ if (!err)
+ mach_port_deallocate (mach_task_self (), rend_port);
mach_port_deallocate (mach_task_self (), newright);
mach_port_move_member (mach_task_self (), newpi->pi.port_right,
diff --git a/libtrivfs/io-reauthenticate.c b/libtrivfs/io-reauthenticate.c
index c75f5fcc..35775e57 100644
--- a/libtrivfs/io-reauthenticate.c
+++ b/libtrivfs/io-reauthenticate.c
@@ -52,7 +52,8 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred,
assert (newright != MACH_PORT_NULL);
err = iohelp_reauth (&newcred->user, auth, rendport, newright, 1);
- mach_port_deallocate (mach_task_self (), rendport);
+ if (!err)
+ mach_port_deallocate (mach_task_self (), rendport);
mach_port_deallocate (mach_task_self (), auth);
if (err)
return err;