7d2009
diff -urNp old/converter/other/svgtopam.c new/converter/other/svgtopam.c
7d2009
--- old/converter/other/svgtopam.c	2017-02-08 12:11:02.593690917 +0100
7d2009
+++ new/converter/other/svgtopam.c	2017-02-08 13:49:38.319029371 +0100
7d2009
@@ -771,12 +771,17 @@ createCanvas(unsigned int const width,
7d2009
 
7d2009
     MALLOCVAR_NOFAIL(canvasP);
7d2009
 
7d2009
-    canvasP->width  = width;
7d2009
-    canvasP->height = height;
7d2009
-    canvasP->pixels = ppm_allocarray(width, height);
7d2009
-    canvasP->maxval = maxval;
7d2009
+    if(canvasP != NULL){
7d2009
+        canvasP->width  = width;
7d2009
+        canvasP->height = height;
7d2009
+        canvasP->pixels = ppm_allocarray(width, height);
7d2009
+        canvasP->maxval = maxval;
7d2009
+
7d2009
+        *canvasPP = canvasP;
7d2009
+    } else {
7d2009
+       pm_error("can't allocate memory for canvas");
7d2009
+    }
7d2009
 
7d2009
-    *canvasPP = canvasP;
7d2009
 }
7d2009
 
7d2009