make sure tif_rawdatasize is zeroed when tif_rawdata is freed/cleared

This commit is contained in:
Frank Warmerdam 2012-06-01 00:55:09 +00:00
parent 0dd52ae391
commit 9184521f3f
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2012-05-31 Frank Warmerdam <warmerdam@google.com>
* libtiff/tif_read.c: Make sure tif_rawdatasize is cleared when tif_rawdata is freed.
* libtiff/tif_getimage.c: Add support for greyscale+alpha c/o Jérémie Laval.
http://bugzilla.maptools.org/show_bug.cgi?id=2398

View File

@ -1,4 +1,4 @@
/* $Id: tif_read.c,v 1.39 2012-05-30 01:50:17 fwarmerdam Exp $ */
/* $Id: tif_read.c,v 1.40 2012-06-01 00:55:09 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -529,6 +529,7 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {
_TIFFfree(tif->tif_rawdata);
tif->tif_rawdata = NULL;
tif->tif_rawdatasize = 0;
}
tif->tif_flags &= ~TIFF_MYBUFFER;
/*
@ -831,6 +832,7 @@ TIFFFillTile(TIFF* tif, uint32 tile)
if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {
_TIFFfree(tif->tif_rawdata);
tif->tif_rawdata = NULL;
tif->tif_rawdatasize = 0;
}
tif->tif_flags &= ~TIFF_MYBUFFER;
/*
@ -920,6 +922,7 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size)
if (tif->tif_flags & TIFF_MYBUFFER)
_TIFFfree(tif->tif_rawdata);
tif->tif_rawdata = NULL;
tif->tif_rawdatasize = 0;
}
if (bp) {
tif->tif_rawdatasize = size;