diff options
-rw-r--r-- | test/quic_txp_test.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/quic_txp_test.c b/test/quic_txp_test.c index 1d71721a6c..e01156d156 100644 --- a/test/quic_txp_test.c +++ b/test/quic_txp_test.c @@ -391,7 +391,6 @@ static int schedule_cfq_new_conn_id(struct helper *h) QUIC_CFQ_ITEM *cfq_item; WPACKET wpkt; BUF_MEM *buf_mem = NULL; - char have_wpkt = 0; size_t l = 0; OSSL_QUIC_FRAME_NEW_CONN_ID ncid = {0}; @@ -406,9 +405,12 @@ static int schedule_cfq_new_conn_id(struct helper *h) if (!TEST_true(WPACKET_init(&wpkt, buf_mem))) goto err; - have_wpkt = 1; - if (!TEST_true(ossl_quic_wire_encode_frame_new_conn_id(&wpkt, &ncid))) + if (!TEST_true(ossl_quic_wire_encode_frame_new_conn_id(&wpkt, &ncid))) { + WPACKET_cleanup(&wpkt); goto err; + } + + WPACKET_finish(&wpkt); if (!TEST_true(WPACKET_get_total_written(&wpkt, &l))) goto err; @@ -423,8 +425,8 @@ static int schedule_cfq_new_conn_id(struct helper *h) rc = 1; err: - if (have_wpkt) - WPACKET_cleanup(&wpkt); + if (!rc) + BUF_MEM_free(buf_mem); return rc; } @@ -470,7 +472,6 @@ static int schedule_cfq_new_token(struct helper *h) QUIC_CFQ_ITEM *cfq_item; WPACKET wpkt; BUF_MEM *buf_mem = NULL; - char have_wpkt = 0; size_t l = 0; if (!TEST_ptr(buf_mem = BUF_MEM_new())) @@ -479,10 +480,13 @@ static int schedule_cfq_new_token(struct helper *h) if (!TEST_true(WPACKET_init(&wpkt, buf_mem))) goto err; - have_wpkt = 1; if (!TEST_true(ossl_quic_wire_encode_frame_new_token(&wpkt, token_1, - sizeof(token_1)))) + sizeof(token_1)))) { + WPACKET_cleanup(&wpkt); goto err; + } + + WPACKET_finish(&wpkt); if (!TEST_true(WPACKET_get_total_written(&wpkt, &l))) goto err; @@ -497,8 +501,8 @@ static int schedule_cfq_new_token(struct helper *h) rc = 1; err: - if (have_wpkt) - WPACKET_cleanup(&wpkt); + if (!rc) + BUF_MEM_free(buf_mem); return rc; } |