# HG changeset patch # User Matt Johnston # Date 1520608597 -28800 # Node ID a57822db3eac92051625e85e0d499a1c957edfce # Parent 97335566a3bb43c4459fc102b76d0e410e8b93f3 Fix leaks in kex fuzzers diff -r 97335566a3bb -r a57822db3eac fuzzer-kexdh.c --- a/fuzzer-kexdh.c Fri Mar 09 20:43:11 2018 +0800 +++ b/fuzzer-kexdh.c Fri Mar 09 23:16:37 2018 +0800 @@ -57,10 +57,14 @@ ses.kexhashbuf = buf_new(KEXHASHBUF_MAX_INTS); kexdh_comb_key(dh_param, &dh_e, svr_opts.hostkey); - /* kexhashbuf is freed in kexdh_comb_key */ + mp_clear(ses.dh_K); m_free(ses.dh_K); mp_clear(&dh_e); + buf_free(ses.hash); + buf_free(ses.session_id); + /* kexhashbuf is freed in kexdh_comb_key */ + m_malloc_free_epoch(1, 0); } else { m_malloc_free_epoch(1, 1); diff -r 97335566a3bb -r a57822db3eac fuzzer-kexecdh.c --- a/fuzzer-kexecdh.c Fri Mar 09 20:43:11 2018 +0800 +++ b/fuzzer-kexecdh.c Fri Mar 09 23:16:37 2018 +0800 @@ -63,10 +63,14 @@ ses.kexhashbuf = buf_new(KEXHASHBUF_MAX_INTS); kexecdh_comb_key(ecdh_param, ecdh_qs, svr_opts.hostkey); - /* kexhashbuf is freed in kexdh_comb_key */ + mp_clear(ses.dh_K); m_free(ses.dh_K); buf_free(ecdh_qs); + buf_free(ses.hash); + buf_free(ses.session_id); + /* kexhashbuf is freed in kexdh_comb_key */ + m_malloc_free_epoch(1, 0); } else { m_malloc_free_epoch(1, 1);