From e886bf34a4e42095824a2b14c40cb19efa80390f Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 31 Oct 2016 21:52:43 +0200 Subject: Fix some valgrind errors. --- io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index ab4029e1..2dbc07a6 100644 --- a/io.c +++ b/io.c @@ -2607,8 +2607,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; -- cgit v1.2.3