diff options
author | Andreas Schwab <schwab@redhat.com> | 2010-11-12 03:51:28 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2010-11-12 03:51:28 -0500 |
commit | 3540d66b669af54900b2e4bfc0ab82960e84a471 (patch) | |
tree | 2798b4dfa450db317e823ab8af0c2cdb2f340fa2 /posix/fnmatch_loop.c | |
parent | 13b695749acf88139a2ce1ed2c949e0e64300a9b (diff) | |
download | glibc-3540d66b669af54900b2e4bfc0ab82960e84a471.tar.gz glibc-3540d66b669af54900b2e4bfc0ab82960e84a471.tar.xz glibc-3540d66b669af54900b2e4bfc0ab82960e84a471.zip |
Fix memory leak in fnmatch
Diffstat (limited to 'posix/fnmatch_loop.c')
-rw-r--r-- | posix/fnmatch_loop.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c index c8e52a6b4d..6b0224ea2c 100644 --- a/posix/fnmatch_loop.c +++ b/posix/fnmatch_loop.c @@ -1114,18 +1114,16 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, int malloced = ! __libc_use_alloca (alloca_used + slen); \ if (__builtin_expect (malloced, 0)) \ { \ - newp = alloca_account (slen, alloca_used); \ - any_malloced = 1; \ - } \ - else \ - { \ newp = malloc (slen); \ if (newp == NULL) \ { \ retval = -2; \ goto out; \ } \ + any_malloced = 1; \ } \ + else \ + newp = alloca_account (slen, alloca_used); \ newp->next = NULL; \ newp->malloced = malloced; \ *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0'); \ |