Skip to content

Commit

Permalink
Stop crash in OOM handling in NSS
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Oct 6, 2011
1 parent 6403122 commit 054c045
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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>

* nss/nsswitch.c (__nss_database_lookup): Handle
Expand Down
8 changes: 3 additions & 5 deletions nss/nsswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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. */
Expand Down

0 comments on commit 054c045

Please sign in to comment.