tabeWed Feb 11 17:56:17 2009 UTC
Modified files:
/php-src/ext/gd/libgd gdxpm.c
Log:
- fixed memory leaks in gdImageCreateFromXpm()
- dropped unused codes
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gdxpm.c?r1=1.9r2=1.10diff_format=u
Index: php-src/ext/gd/libgd/gdxpm.c
diff -u php-src/ext/gd/libgd/gdxpm.c:1.9 php-src/ext/gd/libgd/gdxpm.c:1.10
--- php-src/ext/gd/libgd/gdxpm.c:1.9Thu Aug 18 12:54:31 2005
+++ php-src/ext/gd/libgd/gdxpm.cWed Feb 11 17:56:17 2009
@@ -22,7 +22,6 @@
int i, j, k, number;
char buf[5];
gdImagePtr im = 0;
- char *apixel;
int *pointer;
int red = 0, green = 0, blue = 0;
int *colors;
@@ -34,7 +33,7 @@
}
if (!(im = gdImageCreate(image.width, image.height))) {
- return 0;
+ goto done;
}
number = image.ncolors;
@@ -116,14 +115,8 @@
colors[i] = gdImageColorResolve(im, red, green, blue);
- if (colors[i] == -1) {
- php_gd_error(ARRRGH);
- }
}
- apixel = (char *) gdMalloc(image.cpp + 1);
- apixel[image.cpp] = '\0';
-
pointer = (int *) image.data;
for (i = 0; i image.height; i++) {
for (j = 0; j image.width; j++) {
@@ -132,8 +125,10 @@
}
}
- gdFree(apixel);
gdFree(colors);
+ done:
+ XpmFreeXpmImage(image);
+ XpmFreeXpmInfo(info);
return im;
}
#endif
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php