[GRASS-SVN] r72967 - grass/trunk/lib/ogsf

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 9 13:30:24 PDT 2018


Author: hcho
Date: 2018-07-09 13:30:24 -0700 (Mon, 09 Jul 2018)
New Revision: 72967

Modified:
   grass/trunk/lib/ogsf/gsd_prim.c
Log:
ogsf: G_malloc allocates 1 byte even if 0 is requested; We don't want that

Modified: grass/trunk/lib/ogsf/gsd_prim.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_prim.c	2018-07-08 19:51:27 UTC (rev 72966)
+++ grass/trunk/lib/ogsf/gsd_prim.c	2018-07-09 20:30:24 UTC (rev 72967)
@@ -910,6 +910,9 @@
     *xsize = r - l + 1;
     *ysize = t - b + 1;
 
+    if (!*xsize || !*ysize)
+	return (0);
+
     *pixbuf = (unsigned char *)G_malloc((*xsize) * (*ysize) * 4);	/* G_fatal_error */
 
     if (!*pixbuf)



More information about the grass-commit mailing list