gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-3817-gc15d2d


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-3817-gc15d2db
Date: Fri, 30 Aug 2019 06:24:10 -0400 (EDT)

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 "gawk".

The branch, master has been updated
       via  c15d2db3ce7ea49741d8792190f9212842db86ec (commit)
       via  134f9d04acffcd68c298a7f41419b0620212595e (commit)
      from  58982af68e8cbbc71b48a2ab36865ed4630b960b (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.sv.gnu.org/cgit/gawk.git/commit/?id=c15d2db3ce7ea49741d8792190f9212842db86ec

commit c15d2db3ce7ea49741d8792190f9212842db86ec
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Aug 30 13:23:29 2019 +0300

    Another memory issue fix.

diff --git a/ChangeLog b/ChangeLog
index edf4bf5..5769a71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-08-30         Andrew J. Schorr      <address@hidden>
+
+       * interpret.h (r_interpret): For Op_match_rec, unref if a
+       dynamic regexp. Fixes another memory issue. See the thread starting
+       at https://lists.gnu.org/archive/html/bug-gawk/2019-08/msg00023.html.
+
 2019-08-29         Arnold D. Robbins     <address@hidden>
 
        Restore a modified version of the change of
diff --git a/interpret.h b/interpret.h
index 3215833..6cfff3a 100644
--- a/interpret.h
+++ b/interpret.h
@@ -1065,6 +1065,10 @@ match_re:
                        if (op != Op_match_rec) {
                                decr_sp();
                                DEREF(t1);
+                               if (m->type == Node_dynregex) {
+                                       DEREF(m->re_exp);
+                                       m->re_exp = NULL;
+                               }
                        }
                        r = node_Boolean[di];
                        UPREF(r);

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=134f9d04acffcd68c298a7f41419b0620212595e

commit 134f9d04acffcd68c298a7f41419b0620212595e
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Aug 30 12:57:21 2019 +0300

    Restore modified use of realloc in format_tree.

diff --git a/ChangeLog b/ChangeLog
index b608e02..edf4bf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-08-29         Arnold D. Robbins     <address@hidden>
+
+       Restore a modified version of the change of
+       2016-05-03, which used realloc to shrink the buffer.
+
+       * builtin.c (format_tree): Reduce INITIAL_OUT_SIZE to 64.
+       At the end, call realloc only if there is more
+       than (2 * INITIAL_OUT_SIZE) bytes to give back.
+
 2019-08-23         Arnold D. Robbins     <address@hidden>
 
        * main.c (main): Fix whitespace issues.
diff --git a/builtin.c b/builtin.c
index 503a386..1c107d3 100644
--- a/builtin.c
+++ b/builtin.c
@@ -685,7 +685,7 @@ format_tree(
        int i, nc;
        bool toofew = false;
        char *obuf, *obufout;
-       size_t osiz, ofre;
+       size_t osiz, ofre, olen_final;
        const char *chbuf;
        const char *s0, *s1;
        int cs1;
@@ -735,7 +735,7 @@ format_tree(
        static const char lchbuf[] = "0123456789abcdef";
        static const char Uchbuf[] = "0123456789ABCDEF";
 
-#define INITIAL_OUT_SIZE       512
+#define INITIAL_OUT_SIZE       64
        emalloc(obuf, char *, INITIAL_OUT_SIZE, "format_tree");
        obufout = obuf;
        osiz = INITIAL_OUT_SIZE;
@@ -1646,7 +1646,11 @@ mpf1:
                        _("too many arguments supplied for format string"));
        }
        bchunk(s0, s1 - s0);
-       r = make_str_node(obuf, obufout - obuf, ALREADY_MALLOCED);
+       olen_final = obufout - obuf;
+#define GIVE_BACK_SIZE (INITIAL_OUT_SIZE * 2)
+       if (ofre > GIVE_BACK_SIZE)
+               erealloc(obuf, char *, olen_final + 1, "format_tree");
+       r = make_str_node(obuf, olen_final, ALREADY_MALLOCED);
        obuf = NULL;
 out:
        {

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

Summary of changes:
 ChangeLog   | 15 +++++++++++++++
 builtin.c   | 10 +++++++---
 interpret.h |  4 ++++
 3 files changed, 26 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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