2003.11.18 10:23 "[Tiff] TIFFGetField COLORMAP memory allocation", by Nathan Becker

2003.11.18 10:23 "[Tiff] TIFFGetField COLORMAP memory allocation", by Nathan Becker

Hi,

I'm trying to read the colormap from an RGB palette tiff file using

something like

..._TIFFmalloc(red...);
...green...
...blue...
TIFFGetField(tiff, TIFFTAG_COLORMAP, &red, &green, &blue);
...
_TIFFfree(red);

After a bunch of seg faults and screwing around I realized that TIFFGetField seems to secretly allocate the memory for red, green, and blue. Is this right? The documentation seems to indicate I'm supposed to provide allocated memory to TIFFGetField. Also, if it does secretly allocate memory, then am I supposed to free the red, green, blue arrays? It seems like not because doing so gives me a seg fault.

thanks in advance for the help,

Nathan