From 8d1f33da3b147d1f3c5e769fa902d9a79577baca Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 29 Aug 2018 01:29:08 +0000 Subject: fix crash when out of memory git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3308 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- generator/pamtris/boundaries.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'generator') diff --git a/generator/pamtris/boundaries.c b/generator/pamtris/boundaries.c index a25103a8..8ea28682 100644 --- a/generator/pamtris/boundaries.c +++ b/generator/pamtris/boundaries.c @@ -15,6 +15,7 @@ #include #include +#include #include "utils.h" #include "fract.h" @@ -42,7 +43,12 @@ make_pos_fract(int32_t const quotient, void init_boundary_buffer(boundary_info * const bi, int16_t const height) { - MALLOCARRAY_NOFAIL(bi->buffer, height * 2 * sizeof(int16_t)); + + MALLOCARRAY(bi->buffer, height * 2); + + if (!bi->buffer) + pm_error("Unable to get memory for %u-row high boundary buffer", + height); } -- cgit 1.4.1