if log fails, avoid pms getting double free
doing the pms assignment after log is successful
@@ -2854,13 +2854,13 @@ static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al)
goto err;
}
- s->s3->tmp.pms = pms;
- s->s3->tmp.pmslen = pmslen;
-
/* Log the premaster secret, if logging is enabled. */
if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen))
goto err;
+ s->s3->tmp.pms = pms;
+ s->s3->tmp.pmslen = pmslen;
+
return 1;
err:
OPENSSL_clear_free(pms, pmslen);
