cvs: gd /libgd gd.c
[email protected] ("Nuno Lopes") Sun, 17 Jun 2007 18:56:28 -0000
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvsnlopess1182106588@cvsserver> |
nlopess Sun Jun 17 18:56:28 2007 UTC
Modified files:
/gd/libgd gd.c
Log:
plug a memleak in _gdImageFillTiled() on error condition
replace a malloc+memset with calloc instance
http://cvs.php.net/viewvc.cgi/gd/libgd/gd.c?r1=1.60&r2=1.61&diff_format=u
Index: gd/libgd/gd.c
diff -u gd/libgd/gd.c:1.60 gd/libgd/gd.c:1.61
--- gd/libgd/gd.c:1.60 Fri Jun 15 19:34:31 2007
+++ gd/libgd/gd.c Sun Jun 17 18:56:28 2007
@@ -1,4 +1,4 @@
-/* $Id: gd.c,v 1.60 2007/06/15 19:34:31 nlopess Exp $ */
+/* $Id: gd.c,v 1.61 2007/06/17 18:56:28 nlopess Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -80,12 +80,11 @@
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) {
@@ -2028,6 +2027,7 @@
stack = (struct seg *)gdMalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4));
if (!stack) {
+ gdFree(pts);
return;
}
sp = stack;