diff --git a/converter/other/svgtopam.c b/converter/other/svgtopam.c index ca6f4dc..1d4081a 100644 --- a/converter/other/svgtopam.c +++ b/converter/other/svgtopam.c @@ -784,12 +784,17 @@ createCanvas(unsigned int const width, MALLOCVAR_NOFAIL(canvasP); - canvasP->width = width; - canvasP->height = height; - canvasP->pixels = ppm_allocarray(width, height); - canvasP->maxval = maxval; + if(canvasP != NULL){ + canvasP->width = width; + canvasP->height = height; + canvasP->pixels = ppm_allocarray(width, height); + canvasP->maxval = maxval; + + *canvasPP = canvasP; + } else { + pm_error("can't allocate memory for canvas"); + } - *canvasPP = canvasP; }