about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-23 22:06:25 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-23 22:06:25 +0000
commit47ae3942144cdf43f231a1f8b6b3720a427dbdeb (patch)
tree5dbe5ba4f09b38cc1448238f07a5a2167ae136f7
parentb9b9a51e4911b17e75b39fd3db9f7268e233ce20 (diff)
downloadglibc-47ae3942144cdf43f231a1f8b6b3720a427dbdeb.tar.gz
glibc-47ae3942144cdf43f231a1f8b6b3720a427dbdeb.tar.xz
glibc-47ae3942144cdf43f231a1f8b6b3720a427dbdeb.zip
Update.
	* nis/ypclnt.c (yp_all): Free the dom_binding object after
	unwinding it.
-rw-r--r--ChangeLog3
-rw-r--r--nis/ypclnt.c15
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 6643aa3ff1..146af5d4b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2003-04-23  Ulrich Drepper  <drepper@redhat.com>
 
+	* nis/ypclnt.c (yp_all): Free the dom_binding object after
+	unwinding it.
+
 	* grp/initgroups.c (getgrouplist): Don't copy too much into the
 	user buffer if more groups are found than fit into it.
 
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 7123f636bf..0278dcf15d 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -205,10 +205,15 @@ __yp_bind (const char *domain, dom_binding **ypdb)
       return YPERR_YPSERV;
     }
 
-  if (is_new && ypdb != NULL)
+  if (is_new)
     {
-      ysd->dom_pnext = *ypdb;
-      *ypdb = ysd;
+      if (ypdb != NULL)
+	{
+	  ysd->dom_pnext = *ypdb;
+	  *ypdb = ysd;
+	}
+      else
+	free (ysd);
     }
 
   return YPERR_SUCCESS;
@@ -710,6 +715,8 @@ yp_all (const char *indomain, const char *inmap,
 
       /* We don't need the UDP connection anymore.  */
       __yp_unbind (ydb);
+      free (ydb);
+      ydb = NULL;
 
       clnt = clnttcp_create (&clnt_sin, YPPROG, YPVERS, &clnt_sock, 0, 0);
       if (clnt == NULL)