wolfssl: don't store a NULL sessionid

This caused a memory leak as the session id cache entry was still
erroneously stored with a NULL sessionid and that would later be treated
as not needed to get freed.

Reported-by: Gisle Vanem
Fixes #6616
Closes #6617
This commit is contained in:
Daniel Stenberg 2021-02-17 14:19:57 +01:00
parent f248a13065
commit bc928be02c
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -770,11 +770,10 @@ wolfssl_connect_step3(struct Curl_easy *data, struct connectdata *conn,
if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
SSL_SESSION *our_ssl_sessionid = SSL_get_session(backend->handle);
our_ssl_sessionid = SSL_get_session(backend->handle);
if(our_ssl_sessionid) {
Curl_ssl_sessionid_lock(data);
incache = !(Curl_ssl_getsessionid(data, conn, &old_ssl_sessionid, NULL,
sockindex));
@ -797,6 +796,7 @@ wolfssl_connect_step3(struct Curl_easy *data, struct connectdata *conn,
}
Curl_ssl_sessionid_unlock(data);
}
}
connssl->connecting_state = ssl_connect_done;