glob must not call globfree

Andreas Schwab schwab@suse.de
Thu Feb 7 05:35:00 GMT 2002


This was pointed out by Tim Waugh in private mail: wordexp does not always
call globfree after glob.

Andreas.

2002-02-07  Andreas Schwab  <schwab@suse.de>

	* sysdeps/generic/wordexp.c (do_parse_glob): Always call globfree
	after glob.

--- sysdeps/generic/wordexp.c.~1.6.~	Fri Aug 17 09:15:21 2001
+++ sysdeps/generic/wordexp.c	Thu Feb  7 14:12:33 2002
@@ -1,5 +1,5 @@
 /* POSIX.2 wordexp implementation.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
 
@@ -395,6 +395,7 @@
     {
       /* We can only run into memory problems.  */
       assert (error == GLOB_NOSPACE);
+      globfree (&globbuf);
       return WRDE_NOSPACE;
     }
 

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Libc-hacker mailing list