]> 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:18:25 +0000 (14:18 +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)

(cherry picked from commit 3818f7779ef4bf4d4ccacd13506ec92885e45553)

test/testutil/testutil_init.c

index 87013694c29e474507dc77cb5fe1fc44a4d6c923..31ace0ff1c5e103f84e2192be40765311007c7a9 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);
     }