[PATCH 2/3] nss: Handle nss_parse_service_list out of memory case

Jiri Olsa jolsa@redhat.com
Thu Sep 15 14:24:00 GMT 2011


The nss_parse_service_list function called from __nss_database_lookup
can fail with out of memory error. We need to return an error in this
case to notify callers.

---
2011-09-15  Jiri Olsa <jolsa@redhat.com>

	* nss/nsswitch.c (__nss_database_lookup): Handle
	nss_parse_service_list out of memory case.

diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 3d14ae3..2646d9a 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -147,7 +147,7 @@ __nss_database_lookup (const char *database, const char *alternate_name,
 
   __libc_lock_unlock (lock);
 
-  return 0;
+  return *ni != NULL ? 0 : -1;
 }
 libc_hidden_def (__nss_database_lookup)
 
-- 
1.7.4.4



More information about the Libc-alpha mailing list