grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v2.18-94-g8345ee3


From: Paul Eggert
Subject: grep branch, master, updated. v2.18-94-g8345ee3
Date: Thu, 24 Apr 2014 06:21:05 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  8345ee380535825253744a0b22725171ab02479c (commit)
      from  b80a95691418ce19b42b54c706633ef8be0bd9ee (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=8345ee380535825253744a0b22725171ab02479c


commit 8345ee380535825253744a0b22725171ab02479c
Author: Paul Eggert <address@hidden>
Date:   Wed Apr 23 23:20:35 2014 -0700

    dfa: fix memory leak reintroduced by previous patch
    
    Reported by Norihiro Tanaka in <http://bugs.gnu.org/17328#16>.
    * src/dfa.c (dfaexec): Allocate mb_match_lens and mb_follows only
    if not already allocated.
    (free_mbdata): Null out mb_match_lens to mark it as being freed.

diff --git a/src/dfa.c b/src/dfa.c
index 42a9736..5dc0f09 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -426,7 +426,8 @@ struct dfa
   position_set mb_follows;     /* Follow set added by ANYCHAR and/or MBCSET
                                    on demand.  */
   int *mb_match_lens;           /* Array of length reduced by ANYCHAR and/or
-                                   MBCSET.  */
+                                   MBCSET.  Null if mb_follows.elems has not
+                                   been allocated.  */
 };
 
 /* Some macros for user access to dfa internals.  */
@@ -3245,8 +3246,11 @@ dfaexec (struct dfa *d, char const *begin, char *end,
   if (d->mb_cur_max > 1)
     {
       memset (&d->mbs, 0, sizeof d->mbs);
-      d->mb_match_lens = xnmalloc (d->nleaves, sizeof *d->mb_match_lens);
-      alloc_position_set (&d->mb_follows, d->nleaves);
+      if (! d->mb_match_lens)
+        {
+          d->mb_match_lens = xnmalloc (d->nleaves, sizeof *d->mb_match_lens);
+          alloc_position_set (&d->mb_follows, d->nleaves);
+        }
     }
 
   for (;;)
@@ -3422,6 +3426,7 @@ free_mbdata (struct dfa *d)
   free (d->mbcsets);
   free (d->mb_follows.elems);
   free (d->mb_match_lens);
+  d->mb_match_lens = NULL;
 }
 
 /* Initialize the components of a dfa that the other routines don't

-----------------------------------------------------------------------

Summary of changes:
 src/dfa.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]