This is the mail archive of the libc-alpha@sources.redhat.com 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]

Re: glob memory leak


Andreas Jaeger <aj@suse.de> writes:

|> Hi libc testers and developers,
|> 
|> is anybody interested in debugging glob (sysdeps/generic/glob.c)?

Please try this patch (untested):

2000-07-13  Andreas Schwab  <schwab@suse.de>

	* sysdeps/generic/glob.c (glob): Fix memory leak.
	[SHELL]: Remove reference to undefined variable `files'.

Index: sysdeps/generic/glob.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/glob.c,v
retrieving revision 1.31
diff -u -a -u -r1.31 sysdeps/generic/glob.c
--- sysdeps/generic/glob.c	2000/03/20 00:45:46	1.31
+++ sysdeps/generic/glob.c	2000/07/13 11:51:46
@@ -896,7 +896,6 @@
 	    if (interrupt_state)
 	      {
 		globfree (&dirs);
-		globfree (&files);
 		return GLOB_ABORTED;
 	      }
 	  }
@@ -1007,7 +1006,10 @@
 		pglob->gl_pathv = new_pathv;
 	    }
 	  else
-	    return GLOB_NOMATCH;
+	    {
+	      globfree (&dirs);
+	      return GLOB_NOMATCH;
+	    }
 	}
 
       globfree (&dirs);

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

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