[PATCH] Fix initgrcache.c

Jakub Jelinek jakub@redhat.com
Tue Sep 5 10:28:00 GMT 2006


Hi!

If malloc fails, it will goto out and use there an uninitialized
any_success variable.

2006-09-05  Jakub Jelinek  <jakub@redhat.com>

	* nscd/initgrcache.c (addinitgroupsX): Move any_success
	decl before first goto out.

--- libc/nscd/initgrcache.c.jj	2006-08-03 19:36:25.000000000 +0200
+++ libc/nscd/initgrcache.c	2006-09-05 12:20:29.000000000 +0200
@@ -107,6 +107,7 @@ addinitgroupsX (struct database_dyn *db,
 
   long int start = 0;
   bool all_tryagain = true;
+  bool any_success = false;
 
   /* This is temporary memory, we need not (ad must not) call
      mempool_alloc.  */
@@ -117,7 +118,6 @@ addinitgroupsX (struct database_dyn *db,
     goto out;
 
   /* Nothing added yet.  */
-  bool any_success = false;
   while (! no_more)
     {
       long int prev_start = start;

	Jakub



More information about the Libc-hacker mailing list