about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2011-10-06 03:04:10 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-06 03:04:10 -0400
commit0490345c9fd1f3368f3a515435b0c8a7f6f739fc (patch)
treed2d7ddbe8434cc195255c3c8f9908b01446a4b84
parent3a62d00d408e9ec19479b6c7d39e89021061f9cd (diff)
downloadglibc-0490345c9fd1f3368f3a515435b0c8a7f6f739fc.tar.gz
glibc-0490345c9fd1f3368f3a515435b0c8a7f6f739fc.tar.xz
glibc-0490345c9fd1f3368f3a515435b0c8a7f6f739fc.zip
Handle OOM in NSS
-rw-r--r--ChangeLog5
-rw-r--r--nss/nsswitch.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2fdde34850..33eeafb4ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-15  Jiri Olsa  <jolsa@redhat.com>
+
+	* nss/nsswitch.c (__nss_lookup_function): Handle __tsearch
+	out of memory case.
+
 2011-10-04  Andreas Schwab  <schwab@redhat.com>
 
 	* include/dlfcn.h (__RTLD_NOIFUNC): Define.
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 6c15c3a83f..535d93bb95 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -384,7 +384,10 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
      will be passed to `known_compare' (above).  */
 
   found = __tsearch (&fct_name, &ni->known, &known_compare);
-  if (*found != &fct_name)
+  if (found == NULL)
+    /* This means out-of-memory.  */
+    result = NULL;
+  else if (*found != &fct_name)
     {
       /* The search found an existing structure in the tree.  */
       result = ((known_function *) *found)->fct_ptr;