Skip to content

Commit

Permalink
Handle OOM in NSS
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiri Olsa authored and Ulrich Drepper committed Oct 6, 2011
1 parent 3a62d00 commit 0490345
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 4 additions & 1 deletion nss/nsswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0490345

Please sign in to comment.