Initialize libtiff buffer

This commit is contained in:
Andrew Murray 2022-08-18 19:12:09 +10:00 committed by Hugo van Kemenade
parent e055ef0356
commit 93e5fd4b40

View File

@ -771,11 +771,11 @@ ImagingLibTiffEncodeInit(ImagingCodecState state, char *filename, int fp) {
TRACE(("Opening using fd: %d for writing \n", clientstate->fp)); TRACE(("Opening using fd: %d for writing \n", clientstate->fp));
clientstate->tiff = TIFFFdOpen(fd_to_tiff_fd(clientstate->fp), filename, mode); clientstate->tiff = TIFFFdOpen(fd_to_tiff_fd(clientstate->fp), filename, mode);
} else { } else {
// malloc a buffer to write the tif, we're going to need to realloc or something // calloc a buffer to write the tif, we're going to need to realloc or something
// if we need bigger. // if we need bigger.
TRACE(("Opening a buffer for writing \n")); TRACE(("Opening a buffer for writing \n"));
/* malloc check ok, small constant allocation */ /* calloc check ok, small constant allocation */
clientstate->data = malloc(bufsize); clientstate->data = calloc(bufsize, 1);
clientstate->size = bufsize; clientstate->size = bufsize;
clientstate->flrealloc = 1; clientstate->flrealloc = 1;