1.12.4: Fix memory leaks and gcc compilation warnings

This commit is contained in:
Dmitri Tikhonov 2018-08-27 13:55:06 -04:00
parent 5f5d395b59
commit 6f126d809b
5 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2018-08-27
- 1.12.4
- Fix memory leak when engine is destroyed
- Fix memory leak in http_client
- Fix gcc warning in unit tests
2018-08-22 2018-08-22
- 1.12.3 - 1.12.3

View file

@ -25,7 +25,7 @@ extern "C" {
#define LSQUIC_MAJOR_VERSION 1 #define LSQUIC_MAJOR_VERSION 1
#define LSQUIC_MINOR_VERSION 12 #define LSQUIC_MINOR_VERSION 12
#define LSQUIC_PATCH_VERSION 3 #define LSQUIC_PATCH_VERSION 4
/** /**
* Engine flags: * Engine flags:

View file

@ -574,6 +574,7 @@ lsquic_engine_destroy (lsquic_engine_t *engine)
assert(0 == lsquic_mh_count(&engine->conns_out)); assert(0 == lsquic_mh_count(&engine->conns_out));
assert(0 == lsquic_mh_count(&engine->conns_tickable)); assert(0 == lsquic_mh_count(&engine->conns_tickable));
lsquic_mm_cleanup(&engine->pub.enp_mm);
free(engine->conns_tickable.mh_elems); free(engine->conns_tickable.mh_elems);
free(engine); free(engine);
} }

View file

@ -306,6 +306,7 @@ display_cert_chain (lsquic_conn_t *conn)
name = X509_get_subject_name(cert); name = X509_get_subject_name(cert);
LSQ_INFO("cert #%u: name: %s", i, LSQ_INFO("cert #%u: name: %s", i,
X509_NAME_oneline(name, buf, sizeof(buf))); X509_NAME_oneline(name, buf, sizeof(buf)));
X509_free(cert);
} }
sk_X509_free(chain); sk_X509_free(chain);
@ -712,5 +713,11 @@ main (int argc, char **argv)
if (promise_fd >= 0) if (promise_fd >= 0)
(void) close(promise_fd); (void) close(promise_fd);
while ((pe = TAILQ_FIRST(&client_ctx.hcc_path_elems)))
{
TAILQ_REMOVE(&client_ctx.hcc_path_elems, pe, next_pe);
free(pe);
}
exit(0 == s ? EXIT_SUCCESS : EXIT_FAILURE); exit(0 == s ? EXIT_SUCCESS : EXIT_FAILURE);
} }

View file

@ -281,8 +281,8 @@ run_di_nocopy_test (const struct nocopy_test *test)
{ {
data_frame = di->di_if->di_get_frame(di, nread); data_frame = di->di_if->di_get_frame(di, nread);
assert(data_frame); /* Self-check */ assert(data_frame); /* Self-check */
n_to_read = test->read_until - nread > data_frame->df_size - data_frame->df_read_off n_to_read = test->read_until - nread > (unsigned) data_frame->df_size - data_frame->df_read_off
? data_frame->df_size - data_frame->df_read_off : test->read_until - nread; ? (unsigned) data_frame->df_size - data_frame->df_read_off : test->read_until - nread;
data_frame->df_read_off += n_to_read; data_frame->df_read_off += n_to_read;
nread += n_to_read; nread += n_to_read;
if (data_frame->df_read_off == data_frame->df_size) if (data_frame->df_read_off == data_frame->df_size)