bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] libshouldbeinlibc: fix reference counting in port_name_x


From: Samuel Thibault
Subject: Re: [PATCH 1/3] libshouldbeinlibc: fix reference counting in port_name_xlator_create
Date: Sat, 9 Nov 2013 18:25:30 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Thu 07 Nov 2013 19:12:28 +0100, a écrit :
> Both task ports are deallocated in the destructor, so they must be
> referenced in the constructor.

Ack.

But then we are missing dereference in if (err) case below.

> * libshouldbeinlibc/portxlate.c (port_name_xlator_create): Fix
>   reference counting.
> ---
>  libshouldbeinlibc/portxlate.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libshouldbeinlibc/portxlate.c b/libshouldbeinlibc/portxlate.c
> index 599fb58..18901d5 100644
> --- a/libshouldbeinlibc/portxlate.c
> +++ b/libshouldbeinlibc/portxlate.c
> @@ -35,7 +35,9 @@ port_name_xlator_create (mach_port_t from_task, mach_port_t 
> to_task,
>    if (! x)
>      return ENOMEM;
>  
> +  mach_port_mod_refs (mach_task_self (), from_task, MACH_PORT_RIGHT_SEND, 
> +1);
>    x->from_task = from_task;
> +  mach_port_mod_refs (mach_task_self (), to_task, MACH_PORT_RIGHT_SEND, +1);
>    x->to_task = to_task;
>    x->to_names = 0;
>    x->to_types = 0;
> -- 
> 1.7.10.4
> 
> 

-- 
Samuel
c> ah (on trouve fluide glacial sur le net, ou il faut aller dans le monde reel 
?)
s> dans le monde reel
c> zut



reply via email to

[Prev in Thread] Current Thread [Next in Thread]