tabe Wed Feb 11 17:56:45 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/gd/libgd gdxpm.c Log: MFH: - fixed memory leaks in gdImageCreateFromXpm() - dropped unused codes http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gdxpm.c?r1=1.8.2.1&r2=1.8.2.1.4.1&diff_format=u Index: php-src/ext/gd/libgd/gdxpm.c diff -u php-src/ext/gd/libgd/gdxpm.c:1.8.2.1 php-src/ext/gd/libgd/gdxpm.c:1.8.2.1.4.1 --- php-src/ext/gd/libgd/gdxpm.c:1.8.2.1 Thu Aug 18 12:54:44 2005 +++ php-src/ext/gd/libgd/gdxpm.c Wed Feb 11 17:56:44 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