summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdiskfs/file-exec.c4
-rw-r--r--libnetfs/file-exec.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/libdiskfs/file-exec.c b/libdiskfs/file-exec.c
index 55b33a14..b1cb33c3 100644
--- a/libdiskfs/file-exec.c
+++ b/libdiskfs/file-exec.c
@@ -94,7 +94,7 @@ diskfs_S_file_exec_paths (struct protid *cred,
mach_port_t execserver;
int cached_exec;
struct hurd_userlink ulink;
- mach_port_t right;
+ mach_port_t right, cred_right;
#define RETURN(code) do { err = (code); goto out; } while (0)
@@ -195,6 +195,7 @@ diskfs_S_file_exec_paths (struct protid *cred,
do
{
right = ports_get_send_right (newpi);
+ cred_right = ports_get_send_right (cred);
#ifdef HAVE_EXEC_EXEC_PATHS
err = exec_exec_paths (execserver,
right, MACH_MSG_TYPE_COPY_SEND,
@@ -221,6 +222,7 @@ diskfs_S_file_exec_paths (struct protid *cred,
mach_port_deallocate (mach_task_self (), right);
+ mach_port_deallocate (mach_task_self (), cred_right);
if (err == MACH_SEND_INVALID_DEST)
{
if (cached_exec)
diff --git a/libnetfs/file-exec.c b/libnetfs/file-exec.c
index 8ac0f892..f5d25099 100644
--- a/libnetfs/file-exec.c
+++ b/libnetfs/file-exec.c
@@ -91,7 +91,7 @@ netfs_S_file_exec_paths (struct protid *cred,
gid_t gid;
mode_t mode;
int suid, sgid;
- mach_port_t right;
+ mach_port_t right, cred_right;
if (!cred)
return EOPNOTSUPP;
@@ -169,6 +169,7 @@ netfs_S_file_exec_paths (struct protid *cred,
if (newpi)
{
right = ports_get_send_right (newpi);
+ cred_right = ports_get_send_right (cred);
#ifdef HAVE_EXEC_EXEC_PATHS
err = exec_exec_paths (_netfs_exec,
right, MACH_MSG_TYPE_COPY_SEND,
@@ -195,6 +196,7 @@ netfs_S_file_exec_paths (struct protid *cred,
destroynames, destroynameslen);
mach_port_deallocate (mach_task_self (), right);
+ mach_port_deallocate (mach_task_self (), cred_right);
ports_port_deref (newpi);
}
else