Commits

Remi Collet  committed 98c3fde

use 4k for allocation step

  • Participants
  • Parent commits 6f3c478

Comments (0)

Files changed (1)

File src/gd_webp.c

 	return im;
 }
 
+#define GD_WEBP_ALLOC_STEP (4*1024)
+
 BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx (gdIOCtx * infile)
 {
 	int	width, height, ret;
 	size_t size = 0, n;
 	gdImagePtr im;
 
-	filedata = gdMalloc(1024);
+	filedata = gdMalloc(GD_WEBP_ALLOC_STEP);
 	if (!filedata) {
 		gd_error("WebP decode: alloc failed");
 		return NULL;
 	}
 	read = filedata;
 	do {
-		n = gdGetBuf(read, 1024, infile);
+		n = gdGetBuf(read, GD_WEBP_ALLOC_STEP, infile);
 		if (n>0) {
 			size += n;
-			temp = gdRealloc(filedata, size+1024);
+			temp = gdRealloc(filedata, size+GD_WEBP_ALLOC_STEP);
 			if (temp) {
 				filedata = temp;
 				read = temp + size;