Further additions to free custom fields in _TIFFSetupFieldInfo() function.

See http://bugzilla.remotesensing.org/show_bug.cgi?id=169 for details.
This commit is contained in:
Andrey Kiselev 2002-08-22 18:31:40 +00:00
parent c70e384ae5
commit 1ed16b4290

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirinfo.c,v 1.18 2002-08-15 12:59:50 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirinfo.c,v 1.19 2002-08-22 18:31:40 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -280,6 +280,19 @@ void
_TIFFSetupFieldInfo(TIFF* tif)
{
if (tif->tif_fieldinfo) {
int i;
for (i = 0; i < tif->tif_nfields; i++)
{
TIFFFieldInfo *fld = tif->tif_fieldinfo[i];
if (fld->field_bit == FIELD_CUSTOM &&
strncmp("Tag ", fld->field_name, 4) == 0)
{
_TIFFfree(fld->field_name);
_TIFFfree(fld);
}
}
_TIFFfree(tif->tif_fieldinfo);
tif->tif_nfields = 0;
}
@ -464,7 +477,9 @@ _TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type)
fld->field_passcount = TRUE;
fld->field_name = (char *) _TIFFmalloc(32);
/* note that this name is a special sign to TIFFClose() to free the field*/
/* note that this name is a special sign to TIFFClose() and
* _TIFFSetupFieldInfo() to free the field
*/
sprintf(fld->field_name, "Tag %d", (int) tag);
return fld;