com php-src: Move freeing of truecolor pixels to a function: ext/gd/libgd/gd_topal.c
| From: | Christoph Michael Becker | Date: | Mon, 03 Oct 2016 10:11:46 +0000 |
| Subject: | com php-src: Move freeing of truecolor pixels to a function: ext/gd/libgd/gd_topal.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94820@lists.php.net to get a copy of this message | ||
Commit: 2b134a1dcbc0c168c6c43a838638094d12bdb3d4
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 3 Oct 2016 12:11:46 +0200
Parents: ec591b555f6a902c429f51804cbfcb1c67f8333b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2b134a1dcbc0c168c6c43a838638094d12bdb3d4
Log:
Move freeing of truecolor pixels to a function
We port <https://github.com/libgd/libgd/commit/81675d39>.
Changed paths:
M ext/gd/libgd/gd_topal.c
Diff:
diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c
index 5b84855..a92a7ac 100644
--- a/ext/gd/libgd/gd_topal.c
+++ b/ext/gd/libgd/gd_topal.c
@@ -1442,6 +1442,19 @@ int gdImageTrueColorToPalette (gdImagePtr im, int dither, int colorsWanted)
return gdImageTrueColorToPaletteBody(im, dither, colorsWanted, 0);
}
+static void free_truecolor_image_data(gdImagePtr oim)
+{
+ int i;
+ oim->trueColor = 0;
+ /* Junk the truecolor pixels */
+ for (i = 0; i < oim->sy; i++)
+ {
+ gdFree (oim->tpixels[i]);
+ }
+ gdFree (oim->tpixels);
+ oim->tpixels = 0;
+}
+
/*
* Module initialization routine for 2-pass color quantization.
*/
@@ -1605,16 +1618,11 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int
colors
/* Success! Get rid of the truecolor image data. */
conversionSucceeded = TRUE;
- if (!cimP) {
- oim->trueColor = 0;
- /* Junk the truecolor pixels */
- for (i = 0; i < oim->sy; i++)
- {
- gdFree (oim->tpixels[i]);
- }
- gdFree (oim->tpixels);
- oim->tpixels = 0;
- }
+ if (!cimP)
+ {
+ free_truecolor_image_data(oim);
+ }
+
goto freeQuantizeData;
/* Tediously free stuff. */
outOfMemory: