On Sun, Oct 25, 2015 at 09:27:01AM -0700, Jim Meyering wrote:
grep snapshot: http://meyering.net/grep/grep-ss.tar.xz 1.3 MB http://meyering.net/grep/grep-ss.tar.xz.sig http://meyering.net/grep/grep-2.21.82-fbc5.tar.xzChanges in grep since 2.21.78-7da30: Jim Meyering (4): tests: avoid spurious failure on OpenBSD 5.8 maint: NEWS: correct/amend gnulib: update to latest, for portability fixes gnulib: update to latest Changes in gnulib since 2.21.78-7da30: * gnulib 5513b40...956fa54 (50): <snip>
I'm testing on Debian stretch, with GCC 5.2 -- on a default build, all tests pass (including check-expensive), but adding 'CFLAGS=-fsanitize=address' results in a lot of test failures. After some investigation I found this was due to it detecting memory leaks (though it was a bit tricky to determine that because the detection happened after clean_up_stdout() closed stderr, so the actual report took a bit of fishing to extract).
With the attached patch applied all the grep tests pass, though the gnulib-tests suite still hits 12 failures (gnulib-tests/test-suite.log also attached) -- I could perhaps look into those myself, but I figure someone more familiar with the codebase can probably fix them much more quickly than I could.
Zev
>From 4e43b4d57997e7a4c08cf0134f62e486843df4e3 Mon Sep 17 00:00:00 2001 From: Zev Weiss <z...@bewilderbeest.net> Date: Sun, 25 Oct 2015 21:59:32 -0500 Subject: [PATCH] dfa: plug a memory leak in dfamust (). * src/dfa.c (dfamust): ensure 'mp' is freed. --- src/dfa.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/dfa.c b/src/dfa.c index c1a00f8..9d5808f 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -3936,6 +3936,7 @@ dfamust (struct dfa const *d) { must *mp = NULL; char const *result = ""; + struct dfamust *dm = NULL; size_t i; bool exact = false; bool begline = false; @@ -4147,14 +4148,15 @@ dfamust (struct dfa const *d) } } done: - if (!*result) - return NULL; - - struct dfamust *dm = xmalloc (sizeof *dm); - dm->exact = exact; - dm->begline = begline; - dm->endline = endline; - dm->must = xstrdup (result); + + if (*result) + { + dm = xmalloc (sizeof *dm); + dm->exact = exact; + dm->begline = begline; + dm->endline = endline; + dm->must = xstrdup (result); + } while (mp) { -- 2.6.1
gnulib-test-suite.log.gz
Description: application/gzip