This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]