Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Fix resource leak - sockaddr is not properly freed

Lubos Uhliarik
March 08, 2022 04:36AM
Hi Maxim,

I'm sorry, it's my mistake I missed that

sin = &sockaddr[d].sockaddr_in;

and

dst[d].sockaddr = (struct sockaddr *) sin;

Sorry for the confusion.

Best,
Lubos

On Sun, Mar 6, 2022 at 2:59 AM Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Thu, Mar 03, 2022 at 02:11:26AM +0100, Lubos Uhliarik wrote:
>
> > # HG changeset patch
> > # User Lubos Uhliarik <luhliari@redhat.com>
> > # Date 1646269812 -3600
> > # Thu Mar 03 02:10:12 2022 +0100
> > # Node ID 317e1e4b0c7343c49e0e13fc59ac75a565521b67
> > # Parent a736a7a613ea6e182ff86fbadcb98bb0f8891c0b
> > Fix resource leak - sockaddr is not properly freed
> >
> > sockaddr variable is allocated by ngx_resolver_calloc function but then
> it
> > is
> > going out of scope leaking the storage it points to.
> >
> > diff -r a736a7a613ea -r 317e1e4b0c73 src/core/ngx_resolver.c
> > --- a/src/core/ngx_resolver.c Tue Feb 08 17:35:27 2022 +0300
> > +++ b/src/core/ngx_resolver.c Thu Mar 03 02:10:12 2022 +0100
> > @@ -4260,6 +4260,8 @@
> > }
> > #endif
> >
> > + ngx_resolver_free(r, sockaddr);
> > +
> > return dst;
> > }
>
> Could you please clarify why do you think there is a leak? Note
> that sockaddr is referenced in the dst array, which is being
> returned.
>
> --
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx-devel mailing list -- nginx-devel@nginx.org
> To unsubscribe send an email to nginx-devel-leave@nginx.org
>
>
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[PATCH] Fix resource leak - sockaddr is not properly freed

Lubos Uhliarik 416 March 02, 2022 08:14PM

Re: [PATCH] Fix resource leak - sockaddr is not properly freed

Maxim Dounin 49 March 05, 2022 09:00PM

Re: [PATCH] Fix resource leak - sockaddr is not properly freed

Lubos Uhliarik 75 March 08, 2022 04:36AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 50
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready