Skip to content

Commit 93e5fd4

Browse files
radarherehugovk
authored andcommitted
Initialize libtiff buffer
1 parent e055ef0 commit 93e5fd4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libImaging/TiffDecode.c

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

0 commit comments

Comments
 (0)