1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

Stop crash in OOM handling in NSS

This commit is contained in:
Ulrich Drepper
2011-10-06 03:18:20 -04:00
parent 64031225b2
commit 054c0457fd
2 changed files with 8 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2011-10-06 Ulrich Drepper <drepper@gmail.com>
* nss/nsswitch.c (__nss_lookup_function): Fix order of deleting
from tree and freeing node.
2011-09-25 Jiri Olsa <jolsa@redhat.com> 2011-09-25 Jiri Olsa <jolsa@redhat.com>
* nss/nsswitch.c (__nss_database_lookup): Handle * nss/nsswitch.c (__nss_database_lookup): Handle

View File

@ -407,6 +407,7 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
/* Oops. We can't instantiate this node properly. /* Oops. We can't instantiate this node properly.
Remove it from the tree. */ Remove it from the tree. */
__tdelete (&fct_name, &ni->known, &known_compare); __tdelete (&fct_name, &ni->known, &known_compare);
free (known);
result = NULL; result = NULL;
} }
else else
@ -418,11 +419,8 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
#if !defined DO_STATIC_NSS || defined SHARED #if !defined DO_STATIC_NSS || defined SHARED
/* Load the appropriate library. */ /* Load the appropriate library. */
if (nss_load_library (ni) != 0) if (nss_load_library (ni) != 0)
{ /* This only happens when out of memory. */
/* This only happens when out of memory. */ goto remove_from_tree;
free (known);
goto remove_from_tree;
}
if (ni->library->lib_handle == (void *) -1l) if (ni->library->lib_handle == (void *) -1l)
/* Library not found => function not found. */ /* Library not found => function not found. */