diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-06-24 23:22:35 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-06-25 16:36:10 +0200 |
commit | f762fec323f36fd7da7ad6eddfbbae940ec3229e (patch) | |
tree | 8d5ee8297c94124062f1d5b0fd239c87e44456ca /lib/conncache.c | |
parent | 13120f28b309e6276690383b2daa977ec9aa99c8 (diff) | |
download | curl-f762fec323f36fd7da7ad6eddfbbae940ec3229e.tar.gz |
url: check Curl_conncache_add_conn return code
... it was previously unchecked in two places and thus errors could
remain undetected and cause trouble.
Closes #2681
Diffstat (limited to 'lib/conncache.c')
-rw-r--r-- | lib/conncache.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/conncache.c b/lib/conncache.c index 066542915..76428eb86 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -96,14 +96,13 @@ static void bundle_destroy(struct connectbundle *cb_ptr) } /* Add a connection to a bundle */ -static CURLcode bundle_add_conn(struct connectbundle *cb_ptr, - struct connectdata *conn) +static void bundle_add_conn(struct connectbundle *cb_ptr, + struct connectdata *conn) { Curl_llist_insert_next(&cb_ptr->conn_list, cb_ptr->conn_list.tail, conn, &conn->bundle_node); conn->bundle = cb_ptr; cb_ptr->num_connections++; - return CURLE_OK; } /* Remove a connection from a bundle */ @@ -263,7 +262,7 @@ static void conncache_remove_bundle(struct conncache *connc, CURLcode Curl_conncache_add_conn(struct conncache *connc, struct connectdata *conn) { - CURLcode result; + CURLcode result = CURLE_OK; struct connectbundle *bundle; struct connectbundle *new_bundle = NULL; struct Curl_easy *data = conn->data; @@ -290,13 +289,7 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc, bundle = new_bundle; } - result = bundle_add_conn(bundle, conn); - if(result) { - if(new_bundle) - conncache_remove_bundle(data->state.conn_cache, new_bundle); - goto unlock; - } - + bundle_add_conn(bundle, conn); conn->connection_id = connc->next_connection_id++; connc->num_conn++; |