Re: [PATCH] console-client: deallocate the port once finished with it

2024-03-13 Thread Sergey Bugaev
On Wed, Mar 13, 2024 at 1:56 PM Etienne Brateau
 wrote:
>  console-client/trans.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/console-client/trans.c b/console-client/trans.c
> index b7d56cb0..a3d6dd3c 100644
> --- a/console-client/trans.c
> +++ b/console-client/trans.c
> @@ -898,6 +898,7 @@ console_setup_node (char *path)
>err = file_set_translator (node, 0, FS_TRANS_EXCL | FS_TRANS_SET, 0, 0, 0,
>  right, MACH_MSG_TYPE_COPY_SEND);
>mach_port_deallocate (mach_task_self (), right);
> +  ports_port_deref (newpi);

Makes sense to me.

While at it, you could also replace ports_get_send_right () +
MACH_MSG_TYPE_COPY_SEND + mach_port_deallocate () with ports_get_right
() + MACH_MSG_TYPE_MAKE_SEND.

Sergey



[PATCH] console-client: deallocate the port once finished with it

2024-03-13 Thread Etienne Brateau
---
 console-client/trans.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/console-client/trans.c b/console-client/trans.c
index b7d56cb0..a3d6dd3c 100644
--- a/console-client/trans.c
+++ b/console-client/trans.c
@@ -898,6 +898,7 @@ console_setup_node (char *path)
   err = file_set_translator (node, 0, FS_TRANS_EXCL | FS_TRANS_SET, 0, 0, 0,
 right, MACH_MSG_TYPE_COPY_SEND);
   mach_port_deallocate (mach_task_self (), right);
+  ports_port_deref (newpi);
   if (err)
 error (1, err, "Cannot set translator on underlying node");
 
-- 
2.44.0