MOO-cows Mailing List Archive

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

FIX for memory leak in 1.7.9p2 match()



Here's a patch for the nasty memory leak recently reported in the
implementation of match() in 1.7.9p2.  In the file regexpr.c, add the lines
marked with plus signs below, at the indicated place in the code.

*** regexpr.c.old 1995/11/30 05:38:08
--- regexpr.c     1995/12/18 00:41:15
***************
*** 1261,1266 ****
--- 1261,1268 ----
              memcpy((char *)new_stack_start,
                     (char *)failure_stack_start,
                     failure_stack_size * sizeof(*failure_stack_start));
+             if (failure_stack_start != initial_failure_stack)
+                 free((char *)failure_stack_start);
              failure_stack_start = new_stack_start;
              failure_sp = failure_stack_start + failure_stack_size;
              failure_stack_size *= 2;

This patch will be in 1.8.0alpha3, due out soon.

	Pavel



Home | Subject Index | Thread Index