From c55956b6a10d0a4d0b151c1be976dc9c344c1103 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 14 Dec 2014 20:38:14 +0200 Subject: More fixes to stop allocating an extra byte. --- io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 1d15d887..86dfc135 100644 --- a/io.c +++ b/io.c @@ -2554,7 +2554,7 @@ init_awkpath(path_info *pi) end++; len = end - start; if (len > 0) { - emalloc(p, char *, len + 2, "init_awkpath"); + emalloc(p, char *, len + 1, "init_awkpath"); memcpy(p, start, len); /* add directory punctuation if necessary */ @@ -3040,10 +3040,10 @@ grow_iop_buffer(IOBUF *iop) size_t newsize; /* - * Lop off original extra two bytes, double the size, - * add them back. + * Lop off original extra byte, double the size, + * add it back. */ - newsize = ((iop->size - 2) * 2) + 2; + newsize = ((iop->size - 1) * 2) + 1; /* Check for overflow */ if (newsize <= iop->size) @@ -3051,7 +3051,7 @@ grow_iop_buffer(IOBUF *iop) /* Make sure there's room for a disk block */ if (newsize - valid < iop->readsize) - newsize += iop->readsize + 2; + newsize += iop->readsize + 1; /* Check for overflow, again */ if (newsize <= iop->size) -- cgit v1.2.3