diff options
author | Frank Warmerdam <warmerdam@pobox.com> | 2002-02-24 15:41:41 +0000 |
---|---|---|
committer | Frank Warmerdam <warmerdam@pobox.com> | 2002-02-24 15:41:41 +0000 |
commit | 3a3e43bea523de838151cccd9bb9d023ef0c1994 (patch) | |
tree | 668296fa65e8c4451e53e09cc8a2ea5021c0e5a5 /libtiff/tif_close.c | |
parent | 844aa1cd1ede414436a5ee4811a2c6a75a6eb1f8 (diff) | |
download | libtiff-git-3a3e43bea523de838151cccd9bb9d023ef0c1994.tar.gz |
clean up client info links
Diffstat (limited to 'libtiff/tif_close.c')
-rw-r--r-- | libtiff/tif_close.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/libtiff/tif_close.c b/libtiff/tif_close.c index 7204d3ec..021fe1cb 100644 --- a/libtiff/tif_close.c +++ b/libtiff/tif_close.c @@ -1,4 +1,4 @@ -/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_close.c,v 1.1 1999-07-27 21:50:27 mike Exp $ */ +/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_close.c,v 1.2 2002-02-24 15:41:41 warmerda Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -32,19 +32,32 @@ void TIFFClose(TIFF* tif) { - if (tif->tif_mode != O_RDONLY) - /* - * Flush buffered data and directory (if dirty). - */ - TIFFFlush(tif); - (*tif->tif_cleanup)(tif); - TIFFFreeDirectory(tif); - if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER)) - _TIFFfree(tif->tif_rawdata); - if (isMapped(tif)) - TIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size); - (void) TIFFCloseFile(tif); - if (tif->tif_fieldinfo) - _TIFFfree(tif->tif_fieldinfo); - _TIFFfree(tif); + int i; + + if (tif->tif_mode != O_RDONLY) + /* + * Flush buffered data and directory (if dirty). + */ + TIFFFlush(tif); + (*tif->tif_cleanup)(tif); + TIFFFreeDirectory(tif); + + /* Clean up client info links */ + while( tif->tif_clientinfo ) + { + TIFFClientInfoLink *link = tif->tif_clientinfo; + + tif->tif_clientinfo = link->next; + _TIFFfree( link->name ); + _TIFFfree( link ); + } + + if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER)) + _TIFFfree(tif->tif_rawdata); + if (isMapped(tif)) + TIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size); + (void) TIFFCloseFile(tif); + if (tif->tif_fieldinfo) + _TIFFfree(tif->tif_fieldinfo); + _TIFFfree(tif); } |