On Tue, 5 Sept 2023 at 12:51, Philippe Mathieu-Daudé <phi...@linaro.org> wrote:
>
> On 5/9/23 17:45, Peter Xu wrote:
> > On Mon, Sep 04, 2023 at 11:48:11AM -0300, Fabiano Rosas wrote:
> >> @@ -189,11 +193,14 @@ static void iothread_init(EventLoopBase *base, Error 
> >> **errp)
> >>           return;
> >>       }
> >>
> >> +    thread_name = g_strdup_printf("IO %s",
> >> +                        
> >> object_get_canonical_path_component(OBJECT(base)));
> >> +
> >>       /*
> >>        * Init one GMainContext for the iothread unconditionally, even if
> >>        * it's not used
> >>        */
> >> -    iothread_init_gcontext(iothread);
> >> +    iothread_init_gcontext(iothread, thread_name);
> >>
> >>       iothread_set_aio_context_params(base, &local_error);
> >>       if (local_error) {
> >
> > I think thread_name might be leaked if error here.  Thanks,
>
> Oops, good catch. Better switch to g_autofree.

Yes, please.

And also make the iothread_init_gcontext(..., char *thread_name)
argument const char * to indicate that the name is owned by the caller
and not modified by iothread_init_gcontext().

Thanks,
Stefan

Reply via email to