]> granicus.if.org Git - php/commitdiff
MFH: Fixed memory leak.
authorIlia Alshanetsky <iliaa@php.net>
Wed, 11 Aug 2004 23:25:52 +0000 (23:25 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 11 Aug 2004 23:25:52 +0000 (23:25 +0000)
ext/gd/libgd/gd_topal.c

index cdd90550887cf8af388ac6d12b8e7707cd01191d..15eed3e11ee71a18de0b0508c97cbbf71f722830 100644 (file)
@@ -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;