This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
Patch for NIS memory leak
- To: gafton@redhat.com (Cristian Gafton)
- Subject: Patch for NIS memory leak
- From: hjl@varesearch.com (H.J. Lu)
- Date: Tue, 4 May 1999 19:20:52 -0700 (PDT)
- Cc: libc-hacker@cygnus.com (GNU C Library), kukuk@suse.de
Hi,
This patch patch fixes some, not all, memory leaks in NIS code. The
problem shows up on the NFS server when
1. There is
hosts: files nisplus nis dns
in /etc/nsswitch.conf.
2. Run NIS, not NIS+.
3. /etc/hosts doesn't have the NFS clint IP address.
4. NIS doesn't have the NFS client IP address.
5. DNS has the NFS clint IP address.
6. nscd is not running.
The result is the size of mountd from knfsd 1.2.2a will grow each time
when the NFS client does mount and umount.
Thorsten, could you please take a close look at my patch and other
possible memory leaks?
Thanks.
H.J.
----
Tue May 4 18:38:22 1999 H.J. Lu <hjl@gnu.org>
* nis/nis_table.c (nis_list): Fix some meory leaks.
diff -u -p -r1.1.1.15 nis_table.c
--- nis/nis_table.c 1999/05/05 01:35:26 1.1.1.15
+++ nis/nis_table.c 1999/05/05 01:37:01
@@ -186,6 +186,7 @@ nis_list (const_nis_name name, unsigned
ibreq->ibr_name = NULL;
if (names == NULL)
{
+ nis_free_request (ibreq);
NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
@@ -209,6 +210,7 @@ nis_list (const_nis_name name, unsigned
status = __nisfind_server (ibreq->ibr_name, &dir);
if (status != NIS_SUCCESS)
{
+ nis_free_request (ibreq);
NIS_RES_STATUS (res) = status;
return res;
}
@@ -227,6 +229,7 @@ nis_list (const_nis_name name, unsigned
{
__nisbind_destroy (&bptr);
nis_free_directory (dir);
+ nis_free_request (ibreq);
NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
return res;
}