Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b5cf2c405d550d219483c75f7f227334 > files > 1

libgd-2.1.0-3.1.mga4.src.rpm

--- libgd-2.1.0/src/gdxpm.c~	2013-06-25 05:58:23.000000000 -0400
+++ libgd-2.1.0/src/gdxpm.c	2014-06-12 13:38:59.460025233 -0400
@@ -62,6 +62,12 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro
 
 	for(i = 0; i < number; i++) {
 		char *c_color = image.colorTable[i].c_color;
+		if (!c_color) {
+			/* unsupported color key or color key not defined */
+			gdImageDestroy(im);
+			im = 0;
+			goto done;
+		}
 		if(strcmp(c_color, "None") == 0) {
 			colors[i] = gdImageGetTransparent(im);
 			if(colors[i] == -1) colors[i] = gdImageColorAllocate(im, 0, 0, 0);
@@ -160,9 +166,9 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro
 		}
 	}
 
-	gdFree(colors);
 
 done:
+	gdFree(colors);
 	XpmFreeXpmImage(&image);
 	XpmFreeXpmInfo(&info);
 	return im;