From: Jiri Olsa Date: Thu, 6 Oct 2011 07:04:10 +0000 (-0400) Subject: Handle OOM in NSS X-Git-Tag: upstream/2.30~12039 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0490345c9fd1f3368f3a515435b0c8a7f6f739fc;p=external%2Fglibc.git Handle OOM in NSS --- diff --git a/ChangeLog b/ChangeLog index 2fdde34..33eeafb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-15 Jiri Olsa + + * nss/nsswitch.c (__nss_lookup_function): Handle __tsearch + out of memory case. + 2011-10-04 Andreas Schwab * include/dlfcn.h (__RTLD_NOIFUNC): Define. diff --git a/nss/nsswitch.c b/nss/nsswitch.c index 6c15c3a..535d93b 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;