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-2007-g608c1d


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2007-g608c1d1
Date: Mon, 31 Oct 2016 19:53:00 +0000 (UTC)

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  608c1d180a9e1d132287aacde015dfd0c8fa4953 (commit)
      from  e5abd6a16d42fc0f42277919a2d0a2c28476788c (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=608c1d180a9e1d132287aacde015dfd0c8fa4953

commit 608c1d180a9e1d132287aacde015dfd0c8fa4953
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Oct 31 21:52:43 2016 +0200

    Fix some valgrind errors.

diff --git a/ChangeLog b/ChangeLog
index 2a790fc..1e862c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-10-31         Arnold D. Robbins     <address@hidden>
+
+       Fix valgrind issues.
+
+       * io.c (init_awkpath): Need to allocate max_path+3 pointers.
+       * awkgram.y (make_profile_number): Need to add STRCUR flag and
+       set n->stfmt to STFMT_UNUSED. See the comment in the code.
+
 2016-10-26         Arnold D. Robbins     <address@hidden>
 
        * io.c (init_awkpath): Set max path len for leading separator.
diff --git a/awkgram.c b/awkgram.c
index 0ad0fac..78839fe 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -8619,7 +8619,12 @@ make_profile_number(double d, const char *str, size_t 
len)
                n->stptr = estrdup(str, len + 1);
                n->stptr[len] = '\0';
                n->stlen = len;
-               n->flags |= NUMCONSTSTR;
+               // Set STRCUR and n->stfmt for use when profiling
+               // (i.e., actually running the program) so that
+               // force_string() on this item will work ok.
+               // Thanks and a tip of the hatlo to valgrind.
+               n->flags |= (NUMCONSTSTR|STRCUR);
+               n->stfmt = STFMT_UNUSED;
        }
 
        return n;
diff --git a/awkgram.y b/awkgram.y
index a36e179..4ed1e78 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -6242,7 +6242,12 @@ make_profile_number(double d, const char *str, size_t 
len)
                n->stptr = estrdup(str, len + 1);
                n->stptr[len] = '\0';
                n->stlen = len;
-               n->flags |= NUMCONSTSTR;
+               // Set STRCUR and n->stfmt for use when profiling
+               // (i.e., actually running the program) so that
+               // force_string() on this item will work ok.
+               // Thanks and a tip of the hatlo to valgrind.
+               n->flags |= (NUMCONSTSTR|STRCUR);
+               n->stfmt = STFMT_UNUSED;
        }
 
        return n;
diff --git a/io.c b/io.c
index 816ff56..6f9ffbf 100644
--- a/io.c
+++ b/io.c
@@ -2742,8 +2742,9 @@ init_awkpath(path_info *pi)
                if (*p == envsep)
                        max_path++;
 
-       emalloc(pi->awkpath, char **, (max_path + 1) * sizeof(char *), 
"init_awkpath");
-       memset(pi->awkpath, 0, (max_path + 1) * sizeof(char *));
+       // +3 --> 2 for null entries at front and end of path, 1 for NULL end 
of list
+       emalloc(pi->awkpath, char **, (max_path + 3) * sizeof(char *), 
"init_awkpath");
+       memset(pi->awkpath, 0, (max_path + 3) * sizeof(char *));
 
        start = path;
        i = 0;

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

Summary of changes:
 ChangeLog |    8 ++++++++
 awkgram.c |    7 ++++++-
 awkgram.y |    7 ++++++-
 io.c      |    5 +++--
 4 files changed, 23 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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