aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-12-14 21:29:24 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-12-14 21:29:24 +0200
commit6e786e9ea47966a9cac7cfef4a4079ac379580b0 (patch)
tree5765d8bf454f46a49ee51a5a23a38e10a57bcd1b
parentc55956b6a10d0a4d0b151c1be976dc9c344c1103 (diff)
downloadegawk-6e786e9ea47966a9cac7cfef4a4079ac379580b0.tar.gz
egawk-6e786e9ea47966a9cac7cfef4a4079ac379580b0.tar.bz2
egawk-6e786e9ea47966a9cac7cfef4a4079ac379580b0.zip
Fix to previous change. Now passes valgrind.
-rw-r--r--ChangeLog4
-rw-r--r--io.c3
-rw-r--r--profile.c2
3 files changed, 5 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f890a70d..851eab2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,8 +5,8 @@
* command.y (append_statement): Ditto.
* debug.c (gprintf, serialize): Ditto.
* field.c (set_FIELDWIDTHS): Ditto.
- * io.c.c (init_awkpath, grow_iop_buffer): Ditto.
- * profile.c (pp_string, pp_concat, pp_group3): Ditto.
+ * io.c.c (grow_iop_buffer): Ditto.
+ * profile.c (pp_string, pp_group3): Ditto.
2014-12-14 Andrew J. Schorr <aschorr@telemetry-investments.com>
diff --git a/io.c b/io.c
index 86dfc135..a819a4a8 100644
--- a/io.c
+++ b/io.c
@@ -2554,7 +2554,8 @@ init_awkpath(path_info *pi)
end++;
len = end - start;
if (len > 0) {
- emalloc(p, char *, len + 1, "init_awkpath");
+ /* +2 is correct here; leave room for / */
+ emalloc(p, char *, len + 2, "init_awkpath");
memcpy(p, start, len);
/* add directory punctuation if necessary */
diff --git a/profile.c b/profile.c
index 45eb562c..886f2b0c 100644
--- a/profile.c
+++ b/profile.c
@@ -1505,7 +1505,7 @@ pp_concat(int nargs)
len = -delimlen;
for (i = nargs; i >= 1; i--) {
r = pp_args[i] = pp_pop();
- len += r->pp_len + delimlen + 1;
+ len += r->pp_len + delimlen + 2;
}
emalloc(str, char *, len + 1, "pp_concat");