diff options
author | dgp <dgp@noemail.net> | 2015-05-20 02:41:26 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2015-05-20 02:41:26 (GMT) |
commit | c851f49d0e3fbdbe01a87f09275663e0ff9eb68a (patch) | |
tree | ff86d8f8fff8dc3559eef37260e888f9811adef0 /generic/tkImgGIF.c | |
parent | a07c68be94d69e1fd992b483d7adb6c365afd3f2 (diff) | |
download | tk-c851f49d0e3fbdbe01a87f09275663e0ff9eb68a.zip tk-c851f49d0e3fbdbe01a87f09275663e0ff9eb68a.tar.gz tk-c851f49d0e3fbdbe01a87f09275663e0ff9eb68a.tar.bz2 |
Initialize memory to stop valgrind notices about conditionals dependent on
reads from uninit memory.
FossilOrigin-Name: d1e3a3de43db5b4eafc0c0c3fbc85de34fc0bbfb
Diffstat (limited to 'generic/tkImgGIF.c')
-rw-r--r-- | generic/tkImgGIF.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 27de486..6273c69 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -410,6 +410,7 @@ FileReadGIF( * source and not a file. */ + memset(colorMap, 0, MAXCOLORMAPSIZE*4); memset(gifConfPtr, 0, sizeof(GIFImageConfig)); if (fileName == INLINE_DATA_BINARY || fileName == INLINE_DATA_BASE64) { gifConfPtr->fromData = fileName; @@ -592,6 +593,9 @@ FileReadGIF( if (trashBuffer == NULL) { nBytes = fileWidth * fileHeight * 3; trashBuffer = ckalloc(nBytes); + if (trashBuffer) { + memset(trashBuffer, 0, nBytes); + } } /* @@ -678,6 +682,9 @@ FileReadGIF( block.pitch = block.pixelSize * imageWidth; nBytes = block.pitch * imageHeight; block.pixelPtr = ckalloc(nBytes); + if (block.pixelPtr) { + memset(block.pixelPtr, 0, nBytes); + } if (ReadImage(gifConfPtr, interp, block.pixelPtr, chan, imageWidth, imageHeight, colorMap, srcX, srcY, BitSet(buf[8], INTERLACE), |