diff --git a/CHANGELOG b/CHANGELOG index c6a735504..760cdf65f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2019-09-13 + - 2.3.1 + - [BUGFIX] Fix memory leaks + - [BUGFIX] Fix unit tests + 2019-09-12 - 2.3.0 - [FEATURE] BBR congestion control is on by default diff --git a/include/lsquic.h b/include/lsquic.h index 0a30795a6..009fbfe70 100644 --- a/include/lsquic.h +++ b/include/lsquic.h @@ -25,7 +25,7 @@ extern "C" { #define LSQUIC_MAJOR_VERSION 2 #define LSQUIC_MINOR_VERSION 3 -#define LSQUIC_PATCH_VERSION 0 +#define LSQUIC_PATCH_VERSION 1 /** * Engine flags: diff --git a/src/liblsquic/lsquic_bbr.c b/src/liblsquic/lsquic_bbr.c index 4760cdb25..456dd431d 100644 --- a/src/liblsquic/lsquic_bbr.c +++ b/src/liblsquic/lsquic_bbr.c @@ -1030,6 +1030,7 @@ lsquic_bbr_cleanup (void *cong_ctl) { struct lsquic_bbr *const bbr = cong_ctl; + lsquic_bw_sampler_cleanup(&bbr->bbr_bw_sampler); LSQ_DEBUG("cleanup"); } diff --git a/src/liblsquic/lsquic_send_ctl.c b/src/liblsquic/lsquic_send_ctl.c index d5268d230..4e4923f3d 100644 --- a/src/liblsquic/lsquic_send_ctl.c +++ b/src/liblsquic/lsquic_send_ctl.c @@ -1224,6 +1224,7 @@ lsquic_send_ctl_cleanup (lsquic_send_ctl_t *ctl) } if (ctl->sc_flags & SC_PACE) pacer_cleanup(&ctl->sc_pacer); + ctl->sc_ci->cci_cleanup(CGP(ctl)); #if LSQUIC_SEND_STATS LSQ_NOTICE("stats: n_total_sent: %u; n_resent: %u; n_delayed: %u", ctl->sc_stats.n_total_sent, ctl->sc_stats.n_resent, diff --git a/src/liblsquic/lsquic_stream.c b/src/liblsquic/lsquic_stream.c index 8ed528fab..56ae91a9d 100644 --- a/src/liblsquic/lsquic_stream.c +++ b/src/liblsquic/lsquic_stream.c @@ -599,6 +599,7 @@ lsquic_stream_destroy (lsquic_stream_t *stream) stream_hq_frame_put(stream, shf); destroy_uh(stream); free(stream->sm_buf); + free(stream->sm_header_block); LSQ_DEBUG("destroyed stream"); SM_HISTORY_DUMP_REMAINING(stream); free(stream); diff --git a/test/unittests/test_send_headers.c b/test/unittests/test_send_headers.c index 74a090af4..1d0ab6686 100644 --- a/test/unittests/test_send_headers.c +++ b/test/unittests/test_send_headers.c @@ -151,7 +151,7 @@ static const struct conn_iface our_conn_if = static void init_test_objs (struct test_objs *tobjs, unsigned initial_conn_window, - unsigned initial_stream_window) + unsigned initial_stream_window, enum stream_ctor_flags addl_ctor_flags) { int s; memset(tobjs, 0, sizeof(*tobjs)); @@ -182,7 +182,8 @@ init_test_objs (struct test_objs *tobjs, unsigned initial_conn_window, &tobjs->ver_neg, &tobjs->conn_pub, 0); tobjs->stream_if = &stream_if; tobjs->stream_if_ctx = NULL; - tobjs->ctor_flags = SCF_CALL_ON_NEW|SCF_DI_AUTOSWITCH|SCF_IETF|SCF_HTTP; + tobjs->ctor_flags = SCF_CALL_ON_NEW|SCF_DI_AUTOSWITCH|SCF_HTTP + |addl_ctor_flags; if ((1 << tobjs->lconn.cn_version) & LSQUIC_IETF_VERSIONS) { lsquic_qeh_init(&tobjs->qeh, &tobjs->lconn); @@ -233,7 +234,7 @@ lsquic_qeh_write_headers (struct qpack_enc_hdl *qeh, const struct lsquic_http_headers *headers, unsigned char *buf, size_t *prefix_sz, size_t *headers_sz, uint64_t *completion_offset) { - memset(buf, 0xC5, *prefix_sz + *headers_sz); + memset(buf - *prefix_sz, 0xC5, *prefix_sz + *headers_sz); *prefix_sz = test_vals.prefix_sz; *headers_sz = test_vals.headers_sz; *completion_offset = test_vals.completion_offset; @@ -263,7 +264,7 @@ test_flushes_and_closes (void) /* For our tests purposes, we treat headers as an opaque object */ struct lsquic_http_headers *headers = (void *) 1; - init_test_objs(&tobjs, 0x1000, 0x1000); + init_test_objs(&tobjs, 0x1000, 0x1000, SCF_IETF); stream = new_stream(&tobjs, 0, 0x1000); test_vals.status = QWH_FULL; @@ -352,7 +353,7 @@ test_headers_wantwrite_restoration (const int want_write) /* For our tests purposes, we treat headers as an opaque object */ struct lsquic_http_headers *headers = (void *) 1; - init_test_objs(&tobjs, 0x1000, 0x1000); + init_test_objs(&tobjs, 0x1000, 0x1000, SCF_IETF); /* Mock server side stream cycle */ @@ -445,7 +446,7 @@ test_pp_wantwrite_restoration (const int want_write) s_call_wantwrite_in_ctor = 1; s_wantwrite_arg = want_write; - init_test_objs(&tobjs, 0x1000, 0x1000); + init_test_objs(&tobjs, 0x1000, 0x1000, SCF_IETF); /* Mock server side stream cycle */ @@ -485,6 +486,7 @@ test_pp_wantwrite_restoration (const int want_write) assert(SLIST_FIRST(&stream->sm_promises)->pp_write_state == PPWS_DONE); /* Done! */ assert(want_write == s_onwrite_called); /* Restored: and on_write called */ + lsquic_stream_destroy(stream); deinit_test_objs(&tobjs); s_call_wantwrite_in_ctor = 0; s_wantwrite_arg = 0; @@ -554,10 +556,7 @@ test_read_headers (int ietf, int use_hset) void *hset; unsigned char buf[1]; - init_test_objs(&tobjs, 0x1000, 0x1000); - tobjs.ctor_flags &= ~SCF_IETF; - if (ietf) - tobjs.ctor_flags |= SCF_IETF; + init_test_objs(&tobjs, 0x1000, 0x1000, ietf ? SCF_IETF : 0); stream = new_stream(&tobjs, 0, 0x1000); frame = new_frame_in(&tobjs, 0, 35, 1); diff --git a/test/unittests/test_stream.c b/test/unittests/test_stream.c index 3a9019255..e562d09d6 100644 --- a/test/unittests/test_stream.c +++ b/test/unittests/test_stream.c @@ -372,9 +372,10 @@ deinit_test_objs (struct test_objs *tobjs) lsquic_malo_destroy(tobjs->conn_pub.packet_out_malo); lsquic_mm_cleanup(&tobjs->eng_pub.enp_mm); if ((1 << tobjs->lconn.cn_version) & LSQUIC_IETF_VERSIONS) + { lsquic_qeh_cleanup(&tobjs->qeh); - if (tobjs->ctor_flags & SCF_IETF) lsquic_prio_tree_destroy(tobjs->conn_pub.u.ietf.prio_tree); + } }