Commits

Anonymous committed e27ff25

plug a memleak in _gdImageFillTiled() on error condition
replace a malloc+memset with calloc instance

Comments (0)

Files changed (1)

 		return NULL;
   }
 
-  im = (gdImage *) gdMalloc (sizeof (gdImage));
+	im = (gdImage *) gdCalloc(1, sizeof(gdImage));
 	if (!im) {
 		return NULL;
 	}
 
-  memset (im, 0, sizeof (gdImage));
   /* Row-major ever since gd 1.3 */
   im->pixels = (unsigned char **) gdMalloc (sizeof (unsigned char *) * sy);
 	if (!im->pixels) {
 
 	stack = (struct seg *)gdMalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4));
 	if (!stack) {
+		gdFree(pts);
 		return;
 	}
 	sp = stack;