about summary refs log tree commit diff
path: root/nss/nsswitch.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-06 03:18:20 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-06 03:18:20 -0400
commit054c0457fd670ab29024e5e8655f507aecd68e18 (patch)
treeb154a499429434c277433e7ac22097e52b05248b /nss/nsswitch.c
parent64031225b2595620658640c0b7e01311c8b69a06 (diff)
downloadglibc-054c0457fd670ab29024e5e8655f507aecd68e18.tar.gz
glibc-054c0457fd670ab29024e5e8655f507aecd68e18.tar.xz
glibc-054c0457fd670ab29024e5e8655f507aecd68e18.zip
Stop crash in OOM handling in NSS
Diffstat (limited to 'nss/nsswitch.c')
-rw-r--r--nss/nsswitch.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index ac73984576..924cc84f44 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -407,6 +407,7 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
 	  /* Oops.  We can't instantiate this node properly.
 	     Remove it from the tree.  */
 	  __tdelete (&fct_name, &ni->known, &known_compare);
+	  free (known);
 	  result = NULL;
 	}
       else
@@ -418,11 +419,8 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
 #if !defined DO_STATIC_NSS || defined SHARED
 	  /* Load the appropriate library.  */
 	  if (nss_load_library (ni) != 0)
-	    {
-	      /* This only happens when out of memory.  */
-	      free (known);
-	      goto remove_from_tree;
-	    }
+	    /* This only happens when out of memory.  */
+	    goto remove_from_tree;
 
 	  if (ni->library->lib_handle == (void *) -1l)
 	    /* Library not found => function not found.  */