wc_FreeRng called multiple times in wolfSSL_CTX_set_srp_password

This commit is contained in:
effbiae
2025-10-15 17:43:53 +11:00
parent 3534fad3ee
commit 1de2ad48bd

View File

@@ -12848,19 +12848,16 @@ cleanup:
srp_g, sizeof(srp_g)/sizeof(srp_g[0]),
salt, sizeof(salt)/sizeof(salt[0])) < 0){
WOLFSSL_MSG("wc_SrpSetParam failed");
wc_FreeRng(&rng);
return WOLFSSL_FAILURE;
}
r = wc_SrpSetPassword(ctx->srp, (const byte*)password,
(word32)XSTRLEN(password));
if (r < 0) {
WOLFSSL_MSG("wc_SrpSetPassword failed.");
wc_FreeRng(&rng);
return WOLFSSL_FAILURE;
}
XFREE(ctx->srp_password, NULL, DYNAMIC_TYPE_SRP);
ctx->srp_password = NULL;
wc_FreeRng(&rng);
} else {
/* save password for wolfSSL_set_srp_username */
XFREE(ctx->srp_password, ctx->heap, DYNAMIC_TYPE_SRP);