summary refs log tree commit diff
path: root/nis/nss_nisplus
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nisplus')
-rw-r--r--nis/nss_nisplus/nisplus-alias.c10
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c22
-rw-r--r--nis/nss_nisplus/nisplus-network.c1
-rw-r--r--nis/nss_nisplus/nisplus-publickey.c3
4 files changed, 24 insertions, 12 deletions
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index d7926e1566..86ea5d7a1e 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -304,10 +304,18 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
     }
 
   if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
-    return niserr2nss (result->status);
+    {
+      enum nss_status status = niserr2nss (result->status);
+      nis_freeresult (result);
+      return status;
+    }
 
   parse_res = _nss_nisplus_parse_aliasent (result, 0, alias,
 					   buffer, buflen, errnop);
+
+  /* We do not need the lookup result anymore.  */
+  nis_freeresult (result);
+
   if (__builtin_expect (parse_res < 1, 0))
     {
       __set_errno (olderr);
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index ca0a9e2481..8b628fca81 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -261,17 +261,18 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
 
   int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
 					       buflen, errnop);
+
+  /* We do not need the lookup result anymore.  */
+  nis_freeresult (result);
+
   if (__builtin_expect (parse_res < 1, 0))
     {
       __set_errno (olderr);
 
       if (parse_res == -1)
-	{
-	  nis_freeresult (result);
-	  return NSS_STATUS_TRYAGAIN;
-	}
-      else
-	return NSS_STATUS_NOTFOUND;
+	return NSS_STATUS_TRYAGAIN;
+
+      return NSS_STATUS_NOTFOUND;
     }
 
   return NSS_STATUS_SUCCESS;
@@ -326,13 +327,14 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
 
   int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
 					       buflen, errnop);
+
+  /* We do not need the lookup result anymore.  */
+  nis_freeresult (result);
+
   if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
-	{
-	  nis_freeresult (result);
-	  return NSS_STATUS_TRYAGAIN;
-	}
+	return NSS_STATUS_TRYAGAIN;
 
       return NSS_STATUS_NOTFOUND;
     }
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index 960c0558e9..211e7c3607 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -443,6 +443,7 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type,
 		   removed (one by one) */
 		buf2[b2len - 2] = '\0';
 		b2len -= 2;
+		nis_freeresult (result);
 		continue;
 	      }
 
diff --git a/nis/nss_nisplus/nisplus-publickey.c b/nis/nss_nisplus/nisplus-publickey.c
index c24e898137..24b22d97a0 100644
--- a/nis/nss_nisplus/nisplus-publickey.c
+++ b/nis/nss_nisplus/nisplus-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997,1999,2001,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -394,6 +394,7 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
   if (*uidp == 0)
     {
       syslog (LOG_ERR, _("netname2user: should not have uid 0"));
+      nis_freeresult (res);
       return NSS_STATUS_NOTFOUND;
     }