From c38946f8387e690a08f816f5047ecac6c6fbdca1 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 11 Aug 2004 23:25:54 +0000 Subject: [PATCH] MFH: Fixed memory leak. --- ext/gd/libgd/gd_topal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.50.1