This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: GNU C Library master sources branch, master, updated.glibc-2.12-91-gf15ce4d
- From: Petr Baudis <pasky at suse dot cz>
- To: drepper at sourceware dot org
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 9 Nov 2010 01:58:30 +0100
- Subject: Re: GNU C Library master sources branch, master, updated.glibc-2.12-91-gf15ce4d
- References: <20100810041003.31947.qmail@sourceware.org>
Hi!
On Tue, Aug 10, 2010 at 04:10:03AM -0000, drepper@sourceware.org wrote:
> - Log -----------------------------------------------------------------
> http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f15ce4d8dc139523fe0c273580b604b2453acba6
>
..snip..
> diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c
> index 67c0ee4..c8e52a6 100644
> --- a/posix/fnmatch_loop.c
> +++ b/posix/fnmatch_loop.c
..snip..
> @@ -1102,15 +1108,27 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
> /* This means we found the end of the pattern. */
> #define NEW_PATTERN \
> struct patternlist *newp; \
> - \
> - if (opt == L('?') || opt == L('@')) \
> - newp = alloca (sizeof (struct patternlist) \
> - + (pattern_len * sizeof (CHAR))); \
> + size_t slen = (opt == L('?') || opt == L('@') \
> + ? pattern_len : (p - startp + 1)); \
> + slen = sizeof (struct patternlist) + (slen * sizeof (CHAR)); \
> + int malloced = ! __libc_use_alloca (alloca_used + slen); \
> + if (__builtin_expect (malloced, 0)) \
> + { \
> + newp = alloca_account (slen, alloca_used); \
> + any_malloced = 1; \
> + } \
> else \
> - newp = alloca (sizeof (struct patternlist) \
> - + ((p - startp + 1) * sizeof (CHAR))); \
> - *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0'); \
> + { \
> + newp = malloc (slen); \
> + if (newp == NULL) \
> + { \
> + retval = -2; \
> + goto out; \
> + } \
> + } \
> newp->next = NULL; \
> + newp->malloced = malloced; \
> + *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0'); \
> *lastp = newp; \
> lastp = &newp->next
> NEW_PATTERN;
I think you have meant to set any_malloced = 1 in the else branch
instead?
Kind regards,
Petr "Pasky" Baudis