[PHP-CVS] cvs: php-src /ext/gd/libgd gdxpm.c

2009-02-11 Thread Takeshi Abe
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



[PHP-CVS] cvs: php-src /ext/gd/libgd gdxpm.c

2005-06-16 Thread Ilia Alshanetsky
iliaa   Thu Jun 16 18:50:36 2005 EDT

  Modified files:  
/php-src/ext/gd/libgd   gdxpm.c 
  Log:
  Fixed memory corruption.
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gdxpm.c?r1=1.7r2=1.8ty=u
Index: php-src/ext/gd/libgd/gdxpm.c
diff -u php-src/ext/gd/libgd/gdxpm.c:1.7 php-src/ext/gd/libgd/gdxpm.c:1.8
--- php-src/ext/gd/libgd/gdxpm.c:1.7Sun Dec 28 15:11:08 2003
+++ php-src/ext/gd/libgd/gdxpm.cThu Jun 16 18:50:32 2005
@@ -46,10 +46,10 @@
buf[0] = image.colorTable[i].c_color[1];
red = strtol(buf, NULL, 16);
 
-   buf[0] = image.colorTable[i].c_color[3];
+   buf[0] = image.colorTable[i].c_color[2];
green = strtol(buf, NULL, 16);
 
-   buf[0] = image.colorTable[i].c_color[5];
+   buf[0] = image.colorTable[i].c_color[3];
blue = strtol(buf, NULL, 16);
break;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php