From: "Steinar H. Gunderson" <sesse@debian.org>
To: nfs@lists.sourceforge.net
Subject: [PATCH] Memory leak in mountd
Date: Fri, 11 May 2007 12:49:06 +0200 [thread overview]
Message-ID: <20070511104906.GA21288@uio.no> (raw)
Hi,
A user complained that mountd was slowly eating up all available memory with
about a mount per second. We tracked it down, and ended up with the following
patch:
In client_compose(), free() the hostent structure returned before
exiting. Normally, gethostbyaddr() returns a pointer to a static
struct, but this hostent comes from either get_reliable_hostbyaddr() or
get_hostent(), both which return a pointer they privately xmalloc()ed,
which thus can and should be free()d.
Signed-Off-By: Steinar H. Gunderson <sesse@debian.org>
--- nfs-utils-1.1.0.orig/support/export/client.c
+++ nfs-utils-1.1.0/support/export/client.c
@@ -262,6 +262,7 @@ client_compose(struct in_addr addr)
name = add_name(name, clp->m_hostname);
}
}
+ free(he);
return name;
}
The patch was against 1.0.10 (Debian stable), but should be equivalently
applied for 1.1.0. (Also, we backported the add_name() leak fix.) In
addition, there's a leak in innetgr() (in glibc) that hits mountd quite hard
when using netgroups, but it appears to already be fixed in at least Red Hat,
and I guess this is the wrong place to complain about glibc issues :-)
/* Steinar */
--
Homepage: http://www.sesse.net/
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next reply other threads:[~2007-05-11 10:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-11 10:49 Steinar H. Gunderson [this message]
2007-05-11 11:09 ` [PATCH] Memory leak in mountd Neil Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070511104906.GA21288@uio.no \
--to=sesse@debian.org \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox