]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/testutil/testutil_init.c: Add OPENSSL_free() to avoid memory leak
authorJiashengJiang <jiasheng@purdue.edu>
Mon, 12 May 2025 14:02:05 +0000 (10:02 -0400)
committerTomas Mraz <tomas@openssl.org>
Tue, 13 May 2025 12:17:28 +0000 (14:17 +0200)
Free trace_data if error occurs to avoid memory leak.

Fixes: d73458d17a ("Add tracing capability in test utilities")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27600)

test/testutil/testutil_init.c

index 3301551ab2f7d63d280b3c0c4e2e56e481d31647..69ea27ed2b98851280c997475c7cfd995b2457aa 100644 (file)
@@ -92,6 +92,7 @@ static void setup_trace_category(int category)
                 "warning: unable to setup trace callback for category '%s'.\n",
                 OSSL_trace_get_category_name(category));
 
+        OPENSSL_free(trace_data);
         OSSL_trace_set_callback(category, NULL, NULL);
         BIO_free_all(channel);
     }