Initialize arrays after space allocation.

This commit is contained in:
Andrey Kiselev 2004-09-21 18:27:21 +00:00
parent 653d728173
commit b25a2a7e4d

View File

@ -1,4 +1,4 @@
/* $Id: tif_getimage.c,v 1.38 2004-09-14 06:02:56 dron Exp $ */ /* $Id: tif_getimage.c,v 1.39 2004-09-21 18:27:21 dron Exp $ */
/* /*
* Copyright (c) 1991-1997 Sam Leffler * Copyright (c) 1991-1997 Sam Leffler
@ -561,6 +561,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
int ret = 1, flip; int ret = 1, flip;
buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif)); buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif));
memset(buf, 0, TIFFTileSize(tif));
if (buf == 0) { if (buf == 0) {
TIFFError(TIFFFileName(tif), "No space for tile buffer"); TIFFError(TIFFFileName(tif), "No space for tile buffer");
return (0); return (0);
@ -660,6 +661,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
tilesize = TIFFTileSize(tif); tilesize = TIFFTileSize(tif);
buf = (unsigned char*) _TIFFmalloc(4*tilesize); buf = (unsigned char*) _TIFFmalloc(4*tilesize);
memset(buf, 0, 4*tilesize);
if (buf == 0) { if (buf == 0) {
TIFFError(TIFFFileName(tif), "No space for tile buffer"); TIFFError(TIFFFileName(tif), "No space for tile buffer");
return (0); return (0);
@ -727,9 +729,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
(*put)(img, raster+y*w+col, col, y, (*put)(img, raster+y*w+col, col, y,
npix, nrow, fromskew, toskew + fromskew, npix, nrow, fromskew, toskew + fromskew,
r + pos, g + pos, b + pos, a + pos); r + pos, g + pos, b + pos, a + pos);
} } else {
else
{
(*put)(img, raster+y*w+col, col, y, (*put)(img, raster+y*w+col, col, y,
tw, nrow, 0, toskew, r + pos, g + pos, b + pos, a + pos); tw, nrow, 0, toskew, r + pos, g + pos, b + pos, a + pos);
} }
@ -779,6 +779,7 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
int ret = 1, flip; int ret = 1, flip;
buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif)); buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif));
memset(buf, 0, TIFFStripSize(tif));
if (buf == 0) { if (buf == 0) {
TIFFError(TIFFFileName(tif), "No space for strip buffer"); TIFFError(TIFFFileName(tif), "No space for strip buffer");
return (0); return (0);
@ -788,8 +789,7 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
if (flip & FLIP_VERTICALLY) { if (flip & FLIP_VERTICALLY) {
y = h - 1; y = h - 1;
toskew = -(int32)(w + w); toskew = -(int32)(w + w);
} } else {
else {
y = 0; y = 0;
toskew = -(int32)(w - w); toskew = -(int32)(w - w);
} }
@ -861,6 +861,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
stripsize = TIFFStripSize(tif); stripsize = TIFFStripSize(tif);
r = buf = (unsigned char *)_TIFFmalloc(4*stripsize); r = buf = (unsigned char *)_TIFFmalloc(4*stripsize);
memset(buf, 0, 4*stripsize);
if (buf == 0) { if (buf == 0) {
TIFFError(TIFFFileName(tif), "No space for tile buffer"); TIFFError(TIFFFileName(tif), "No space for tile buffer");
return (0); return (0);