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