Patch for memory leak in vfs_defaults.c

Jeremy Allison jra at samba.org
Fri Apr 6 22:50:27 UTC 2018


On Sat, Apr 07, 2018 at 12:43:15AM +0200, Timur I. Bakeyev wrote:
> On 6 April 2018 at 22:55, Jeremy Allison via samba-technical <
> samba-technical at lists.samba.org> wrote:
> 
>     On Fri, Apr 06, 2018 at 04:40:44PM -0400, Andrew Walker via samba-technical
>     wrote:
>     > Hi all,
>     > I encountered an issue where several FreeNAS users on samba 4.7 were
>     > experiencing memory leak resulting in single smbd process consuming all
>     > available RAM and swap space. Disabling the getwd cache significantly
>     > increased rate of leak, and enabling widelinks / disabling unix
>     extensions
>     > made the leak apparently stop. Investigation indicated that the leak was
>     in
>     > vfswrap_getwd().
>     >
>     > The attached patch resolved the issue.
> 
>     Oh god that's *embarassing*. Looks like my fault too, sorry.
> 
>     Thanks very much for finding that.
> 
>     Can you try the attached patch instead and confirm it fixes it,
>     it's a smaller and simpler change.
> 
> 
> I asked Andrew to change it this way, as it then fully mimics `vfswrap_realpath
> ()` function, which in a lot of aspects behaves the same(and allocates malloc()
> ed buffer as well). Of course it's a matter of taste,
> but my idea was that we'd try to keep the style of the similar functions also
> similar, which ease the reading of code.

No, I much prefer the simpler patch. I'll add in a comment
as well to explain the bug when I repost on samba-technical.



More information about the samba-technical mailing list