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.
pull/943/head
John Safranek 2026-04-21 10:41:08 -07:00 committed by Paul Adelsbach
parent 19d34a8df7
commit afedde7a1d
1 changed files with 1 additions and 0 deletions

View File

@ -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);