From 1432bf0934ba8320f55c76c5e503e4a41b6fba6b Mon Sep 17 00:00:00 2001 From: helanfeng Date: Mon, 11 Nov 2024 15:39:59 +0800 Subject: fix test mem leak --- decoders/dtls/test/dtls_test.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/decoders/dtls/test/dtls_test.cpp b/decoders/dtls/test/dtls_test.cpp index 33490df..438dd34 100644 --- a/decoders/dtls/test/dtls_test.cpp +++ b/decoders/dtls/test/dtls_test.cpp @@ -110,12 +110,13 @@ TEST(dtls_decoder, dtls_try_assemble_fragments) dtls_parser_hello(NULL, &handshake_hs, &dtls_msg, NULL); EXPECT_EQ(dtls_msg.msg_type , DTLS_MSG_TYPE_CLIENT_HELLO); ASSERT_TRUE(dtls_msg.msg_content!=NULL); - struct dtls_handshake *hello_info=(struct dtls_handshake *)dtls_msg.msg_content; + struct dtls_handshake *dtls_hs=(struct dtls_handshake *)dtls_msg.msg_content; char sni_str[512]={0}; - memcpy(sni_str, hello_info->sni, hello_info->sni_sz); - sni_str[hello_info->sni_sz]='\0'; + memcpy(sni_str, dtls_hs->sni, dtls_hs->sni_sz); + sni_str[dtls_hs->sni_sz]='\0'; EXPECT_STREQ(sni_str, "localhost"); + if(dtls_hs->extensions!=NULL) utarray_free(dtls_hs->extensions); free(dtls_msg.msg_content); free(parse_ctx->fragments_head->fragment_content); free(parse_ctx->fragments_head); -- cgit v1.2.3