From 02c51d366246a49c414fc580239e332745d974a3 Mon Sep 17 00:00:00 2001 From: Jason Rohrer Date: Mon, 28 Aug 2017 18:28:14 -0700 Subject: [PATCH] Fixed loads of uninitilized value errors found with Valgrind by memsetting m_dict to 0 in tdefl_init. --- miniz_tdef.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/miniz_tdef.c b/miniz_tdef.c index ef6e088..3f71dfa 100644 --- a/miniz_tdef.c +++ b/miniz_tdef.c @@ -1334,6 +1334,8 @@ tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_fun d->m_pSrc = NULL; d->m_src_buf_left = 0; d->m_out_buf_ofs = 0; + if (!(flags & TDEFL_NONDETERMINISTIC_PARSING_FLAG)) + MZ_CLEAR_OBJ(d->m_dict); memset(&d->m_huff_count[0][0], 0, sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0); memset(&d->m_huff_count[1][0], 0, sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1); return TDEFL_STATUS_OKAY;