From afedde7a1d515d1b2fd0c02034cf81b3642035f0 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 21 Apr 2026 10:41:08 -0700 Subject: [PATCH] Fix Potential Double Free Static analysis indicated the potential to double-free a pointer in the `wolfSSH_CTX_UseCert_buffer()` test. Loading the second cert after freeing the first cert could fail and the test cleanup would free the pointer again. Just set pointer to null after freeing. --- tests/api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/api.c b/tests/api.c index c5211a52..f56f8c44 100644 --- a/tests/api.c +++ b/tests/api.c @@ -579,6 +579,7 @@ static void test_wolfSSH_CTX_UseCert_buffer(void) wolfSSH_CTX_UseCert_buffer(ctx, cert, certSz, 99)); free(cert); + cert = NULL; AssertIntEQ(0, load_file("./keys/server-cert.der", &cert, &certSz)); AssertNotNull(cert);