This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
glob must never call globfree by itself, it is the sole resposibility of
the caller to do that.
Andreas.
2002-02-07 Andreas Schwab <schwab@suse.de>
* sysdeps/generic/glob.c: Don't call globfree on the passed glob
structure.
--- sysdeps/generic/glob.c.~1.40.~ Wed Jan 2 11:11:57 2002
+++ sysdeps/generic/glob.c Thu Feb 7 13:39:11 2002
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -417,11 +417,7 @@
#else
char *onealt = (char *) malloc (strlen (pattern) - 1);
if (onealt == NULL)
- {
- if (!(flags & GLOB_APPEND))
- globfree (pglob);
- return GLOB_NOSPACE;
- }
+ return GLOB_NOSPACE;
#endif
/* We know the prefix for all sub-patterns. */
@@ -500,8 +496,6 @@
#ifndef __GNUC__
free (onealt);
#endif
- if (!(flags & GLOB_APPEND))
- globfree (pglob);
return result;
}
@@ -932,7 +926,6 @@
if (status != 0)
{
globfree (&dirs);
- globfree (pglob);
return status;
}
@@ -942,7 +935,6 @@
pglob->gl_pathc - old_pathc))
{
globfree (&dirs);
- globfree (pglob);
return GLOB_NOSPACE;
}
}
@@ -974,7 +966,6 @@
if (pglob->gl_pathv[newcount] == NULL)
{
globfree (&dirs);
- globfree (pglob);
return GLOB_NOSPACE;
}
@@ -1007,10 +998,7 @@
if (prefix_array (dirname,
&pglob->gl_pathv[old_pathc + pglob->gl_offs],
pglob->gl_pathc - old_pathc))
- {
- globfree (pglob);
- return GLOB_NOSPACE;
- }
+ return GLOB_NOSPACE;
}
}
@@ -1033,10 +1021,7 @@
size_t len = strlen (pglob->gl_pathv[i]) + 2;
char *new = realloc (pglob->gl_pathv[i], len);
if (new == NULL)
- {
- globfree (pglob);
- return GLOB_NOSPACE;
- }
+ return GLOB_NOSPACE;
strcpy (&new[len - 2], "/");
pglob->gl_pathv[i] = new;
}
--
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."
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |