2008-09-01 03:53:15

by lioupayphone

[permalink] [raw]
Subject: mem leak?

Hi, linux-nfs :

in nfs-utils1.1.3, procedure "get_exportlist()" would malloc() some memory for storing the directories and groups for "showmount". obviously those memory are not released when the procedure ends. once mountd received a signal for quiting itself(eg : kill -9 `pidof mountd`), it will call "killer()" for some exiting-works. but those memory allocated in "get_exportlist()" were not released. memory leak? i am not sure. :-(


Payphone LIOU



2008-09-01 21:20:05

by J. Bruce Fields

[permalink] [raw]
Subject: Re: mem leak?

On Mon, Sep 01, 2008 at 11:53:07AM +0800, Payphone LIOU wrote:
> Hi, linux-nfs :
>
> in nfs-utils1.1.3, procedure "get_exportlist()" would malloc() some
> memory for storing the directories and groups for "showmount".
> obviously those memory are not released when the procedure ends.
> once mountd received a signal for quiting itself(eg : kill -9 `pidof
> mountd`), it will call "killer()" for some exiting-works. but those
> memory allocated in "get_exportlist()" were not released. memory
> leak? i am not sure. :-(

You're talking about the allocation done on this line?:

e = (struct exportnode *) xmalloc(sizeof(*e));

>From a quick glance, it looks like the code tries to free that up the
next time get_exportlist() is called, in that first loop over elist. I
haven't tried to figure out whether that code's correct, though; maybe
you have? Patches always welcome.

--b.