--- ray/src/px/clrtab.c 1993/06/10 15:45:18 2.7 +++ ray/src/px/clrtab.c 1993/12/09 12:04:23 2.9 @@ -77,6 +77,8 @@ int ncolors; #ifdef CLOSEST closest(ncolors); /* ensure colors picked are closest */ #endif + /* reset dithering function */ + dith_colrs((BYTE *)NULL, (COLR *)NULL, 0); /* return new color table size */ return(ncolors); } @@ -107,16 +109,17 @@ register BYTE *bs; register COLR *cs; int n; { - static short (*cerr)[3]; + static short (*cerr)[3] = NULL; static int N = 0; int err[3], errp[3]; register int x, i; if (n != N) { /* get error propogation array */ - if (N) - cerr = (short (*)[3])realloc((char *)cerr, - 3*n*sizeof(short)); - else + if (N) { + free((char *)cerr); + cerr = NULL; + } + if (n) cerr = (short (*)[3])malloc(3*n*sizeof(short)); if (cerr == NULL) { N = 0;