From 65f9cdb4982157b250e06be3e0007d17a389bc3b Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Wed, 2 Jul 2025 15:25:44 -0600 Subject: [PATCH] free p2 before reassigning to reEncoded value --- tests/api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/api.c b/tests/api.c index 1c20975fc..673ec3038 100644 --- a/tests/api.c +++ b/tests/api.c @@ -19598,6 +19598,9 @@ static int test_wolfSSL_d2i_ASN1_INTEGER(void) a->isDynamic = 0; a->data = a->intData; } + /* Reset p2 to NULL. */ + XFREE(p2, NULL, DYNAMIC_TYPE_ASN1); + /* Set a to valid value. */ ExpectIntEQ(wolfSSL_ASN1_INTEGER_set(a, 1), WOLFSSL_SUCCESS); /* NULL output buffer. */ @@ -19637,7 +19640,6 @@ static int test_wolfSSL_d2i_ASN1_INTEGER(void) reEncoded = NULL; wolfSSL_ASN1_INTEGER_free(a); a = NULL; - p2 = NULL; } #endif /* OPENSSL_EXTRA */ return EXPECT_RESULT();