diff options
author | fvogel <fvogelnew1@free.fr> | 2024-06-11 03:34:15 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2024-06-11 03:34:15 (GMT) |
commit | c9fe293db7a52a34954db92d2bdc5454d4de3897 (patch) | |
tree | 39c9342e0c9b887fedff449c1ac24969e0352c94 /generic/tkImgGIF.c | |
parent | 530397e0787965a065721a983cfea4da07446f1b (diff) | |
parent | 15dc2cfa976b10c2dcd29e446a331a7d7f04b790 (diff) | |
download | tk-c9fe293db7a52a34954db92d2bdc5454d4de3897.zip tk-c9fe293db7a52a34954db92d2bdc5454d4de3897.tar.gz tk-c9fe293db7a52a34954db92d2bdc5454d4de3897.tar.bz2 |
Fix [1576528fff]: image read file with -from option. (and resolve merge conflicts)
Diffstat (limited to 'generic/tkImgGIF.c')
-rw-r--r-- | generic/tkImgGIF.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 9b70344..6368972 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -704,6 +704,7 @@ FileReadGIF( } if ((width > 0) && (height > 0)) { + unsigned char* pixelPtr; Tk_PhotoImageBlock block; int transparent = -1; if (gifGraphicControlExtensionBlock.blockPresent) { @@ -729,23 +730,25 @@ FileReadGIF( goto error; } nBytes = block.pitch * imageHeight; - block.pixelPtr = (unsigned char *)ckalloc(nBytes); - if (block.pixelPtr) { - memset(block.pixelPtr, 0, nBytes); + pixelPtr = (unsigned char*)ckalloc(nBytes); + if (pixelPtr) { + memset(pixelPtr, 0, nBytes); } + block.pixelPtr = pixelPtr; if (ReadImage(gifConfPtr, interp, block.pixelPtr, chan, imageWidth, imageHeight, colorMap, srcX, srcY, BitSet(buf[8], INTERLACE), transparent) != TCL_OK) { - ckfree(block.pixelPtr); + ckfree(pixelPtr); goto error; } + block.pixelPtr += srcX * block.pixelSize + srcY * block.pitch; if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { - ckfree(block.pixelPtr); + ckfree(pixelPtr); goto error; } - ckfree(block.pixelPtr); + ckfree(pixelPtr); } /* |