diff options
author | David Cole <david.cole@kitware.com> | 2009-11-18 21:47:00 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-11-18 21:47:00 (GMT) |
commit | cf133ff6b35022ee323a6973ae34009016269d79 (patch) | |
tree | 9a1d0cf4caee988ad19f7bdbe0f9c7631af34461 /Utilities/cmzlib | |
parent | 5ca6f158d4c54611ae602490da93c8c00dfbe7d4 (diff) | |
download | CMake-cf133ff6b35022ee323a6973ae34009016269d79.zip CMake-cf133ff6b35022ee323a6973ae34009016269d79.tar.gz CMake-cf133ff6b35022ee323a6973ae34009016269d79.tar.bz2 |
Fix uninitialized variable access in zlib reported by valgrind. Their web site claims it does no harm ( http://www.zlib.net/zlib_faq.html#faq36 ), but fixing it this way eliminates the problem.
Diffstat (limited to 'Utilities/cmzlib')
-rw-r--r-- | Utilities/cmzlib/deflate.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Utilities/cmzlib/deflate.c b/Utilities/cmzlib/deflate.c index 29ce1f6..a5e7a35 100644 --- a/Utilities/cmzlib/deflate.c +++ b/Utilities/cmzlib/deflate.c @@ -285,6 +285,13 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + + // The following memset eliminates the valgrind uninitialized warning + // "swept under the carpet" here: + // http://www.zlib.net/zlib_faq.html#faq36 + // + memset(s->window, 0, s->w_size*2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); |