All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Memory leak in mountd
@ 2007-05-11 10:49 Steinar H. Gunderson
  2007-05-11 11:09 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Steinar H. Gunderson @ 2007-05-11 10:49 UTC (permalink / raw)
  To: nfs

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-11 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11 10:49 [PATCH] Memory leak in mountd Steinar H. Gunderson
2007-05-11 11:09 ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.