From 6eb703682111782bbf570769d907e588f2d59385 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 26 Mar 2020 02:08:27 +0000 Subject: Release 10.73.31 git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3776 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/pmfileio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pmfileio.c b/lib/pmfileio.c index 8176ae6a..a0810e52 100644 --- a/lib/pmfileio.c +++ b/lib/pmfileio.c @@ -807,6 +807,10 @@ pm_read_unknown_size(FILE * const file, nalloc = PM_BUF_SIZE; MALLOCARRAY(buf, nalloc); + if (!buf) + pm_error("Failed to allocate %lu bytes for read buffer", + (unsigned long) nalloc); + eof = FALSE; /* initial value */ while(!eof) { @@ -817,7 +821,10 @@ pm_read_unknown_size(FILE * const file, nalloc += PM_MAX_BUF_INC; else nalloc += nalloc; - REALLOCARRAY_NOFAIL(buf, nalloc); + REALLOCARRAY(buf, nalloc); + if (!buf) + pm_error("Failed to allocate %lu bytes for read buffer", + (unsigned long) nalloc); } val = getc(file); -- cgit 1.4.1