From 6e786e9ea47966a9cac7cfef4a4079ac379580b0 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 14 Dec 2014 21:29:24 +0200 Subject: Fix to previous change. Now passes valgrind. --- io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'io.c') 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 */ -- cgit v1.2.3