summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/gd/libgd/gd_topal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c
index cdd9055088..15eed3e11e 100644
--- a/ext/gd/libgd/gd_topal.c
+++ b/ext/gd/libgd/gd_topal.c
@@ -1926,7 +1926,8 @@ static void gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int color
init_error_limit (oim, nim, cquantize);
arraysize = (size_t) ((nim->sx + 2) * (3 * sizeof (FSERROR)));
/* Allocate Floyd-Steinberg workspace. */
- cquantize->fserrors = gdCalloc (arraysize, 1);
+ cquantize->fserrors = gdRealloc(cquantize->fserrors, arraysize);
+ memset(cquantize->fserrors, 0, arraysize);
if (!cquantize->fserrors)
{
goto outOfMemory;