]> sourceware.org Git - glibc.git/commitdiff
Stop crash in OOM handling in NSS
authorUlrich Drepper <drepper@gmail.com>
Thu, 6 Oct 2011 07:18:20 +0000 (03:18 -0400)
committerUlrich Drepper <drepper@gmail.com>
Thu, 6 Oct 2011 07:18:20 +0000 (03:18 -0400)
ChangeLog
nss/nsswitch.c

index 52d4f1c1d85956252047d740980c68c0a6b9205e..710d6db138b5f4f9c680bafd361b4885c840959a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index ac73984576d9d9a36d339fa76563983634d4ebf3..924cc84f44d33383d90a9fbc025acb3d92eeb101 100644 (file)
@@ -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
@@ -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.  */
This page took 0.046269 seconds and 5 git commands to generate.