Commits

Anonymous committed c94b30f

check whether a new image is null or not.

  • Participants
  • Parent commits e28f8ef
  • Branches GD-2.0

Comments (0)

Files changed (2)

 	gdImagePtr dst;
 
 	dst = gdImageCreateTrueColor(crop->width, crop->height);
+	if (!dst) return NULL;
 	gdImageCopy(dst, src, 0, 0, crop->x, crop->y, crop->width, crop->height);
 
 	return dst;
 	if (!force_rgba && 
 			(image_type == GD_PALETTE || image_type == GD_INDEXED || image_type == GD_GRAY)) {
 		im = gdImageCreate(width, height);
+		if (!im) goto error;
 		readTiffColorMap(im, tif, is_bw, photometric);
 	} else {
 		im = gdImageCreateTrueColor(width, height);
+		if (!im) goto error;
 	}
 
 #ifdef DEBUG