Skip to content

Commit 51b946d

Browse files
committed
Attempt to fix client curl crash described in #831
* Cherry-picked curl change from curl/curl@927a5bd - Potentially two more commits that have to be cherry-picked into our build from curl master to completely wipe out this crash, but we will see. - More information at issue #831
1 parent 36f686d commit 51b946d

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

vendor/curl/lib/url.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -788,19 +788,18 @@ CURLcode Curl_disconnect(struct Curl_easy *data,
788788
/* This is set if protocol-specific cleanups should be made */
789789
conn->handler->disconnect(conn, dead_connection);
790790

791-
/* unlink ourselves! */
792791
infof(data, "Closing connection %ld\n", conn->connection_id);
792+
Curl_ssl_close(conn, FIRSTSOCKET);
793+
Curl_ssl_close(conn, SECONDARYSOCKET);
794+
795+
/* unlink ourselves! */
793796
Curl_conncache_remove_conn(data, conn, TRUE);
794797

795798
free_idnconverted_hostname(&conn->host);
796799
free_idnconverted_hostname(&conn->conn_to_host);
797800
free_idnconverted_hostname(&conn->http_proxy.host);
798801
free_idnconverted_hostname(&conn->socks_proxy.host);
799802

800-
/* this assumes that the pointer is still there after the connection was
801-
detected from the cache */
802-
Curl_ssl_close(conn, FIRSTSOCKET);
803-
804803
conn_free(conn);
805804
return CURLE_OK;
806805
}

vendor/curl/lib/vtls/schannel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,8 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex)
19601960
char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
19611961
conn->host.name;
19621962

1963+
DEBUGASSERT(data);
1964+
19631965
infof(data, "schannel: shutting down SSL/TLS connection with %s port %hu\n",
19641966
hostname, conn->remote_port);
19651967

@@ -2035,11 +2037,9 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex)
20352037
* might not have an associated transfer so the check for conn->data is
20362038
* necessary.
20372039
*/
2038-
if(conn->data)
2039-
Curl_ssl_sessionid_lock(conn);
2040+
Curl_ssl_sessionid_lock(conn);
20402041
Curl_schannel_session_free(BACKEND->cred);
2041-
if(conn->data)
2042-
Curl_ssl_sessionid_unlock(conn);
2042+
Curl_ssl_sessionid_unlock(conn);
20432043
BACKEND->cred = NULL;
20442044
}
20452045

0 commit comments

Comments
 (0)