1. libgd
  2. Untitled project
  3. gd-libgd

Commits

nlopess  committed e27ff25

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

  • Participants
  • Parent commits e2f54c1
  • Branches GD-2.0

Comments (0)

Files changed (1)

File src/gd.c

View file
 		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;