diff options
| author | Takeshi Abe <tabe@php.net> | 2009-02-11 17:56:17 +0000 |
|---|---|---|
| committer | Takeshi Abe <tabe@php.net> | 2009-02-11 17:56:17 +0000 |
| commit | 4c0cbee415640142933df027a6c25d948d3d4f56 (patch) | |
| tree | a524248fd9c3c6a8e32d79866e382df4abe8618e | |
| parent | 9874bacbc9162a4954104447ff558c9f7a5e7692 (diff) | |
| download | php-git-4c0cbee415640142933df027a6c25d948d3d4f56.tar.gz | |
- fixed memory leaks in gdImageCreateFromXpm()
- dropped unused codes
| -rw-r--r-- | ext/gd/libgd/gdxpm.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/ext/gd/libgd/gdxpm.c b/ext/gd/libgd/gdxpm.c index 785afb3680..73f86e5df7 100644 --- a/ext/gd/libgd/gdxpm.c +++ b/ext/gd/libgd/gdxpm.c @@ -22,7 +22,6 @@ gdImagePtr gdImageCreateFromXpm (char *filename) 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 @@ gdImagePtr gdImageCreateFromXpm (char *filename) } if (!(im = gdImageCreate(image.width, image.height))) { - return 0; + goto done; } number = image.ncolors; @@ -116,14 +115,8 @@ gdImagePtr gdImageCreateFromXpm (char *filename) 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 @@ gdImagePtr gdImageCreateFromXpm (char *filename) } } - gdFree(apixel); gdFree(colors); + done: + XpmFreeXpmImage(&image); + XpmFreeXpmInfo(&info); return im; } #endif |
