[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 117/163: url: check Curl_conncache_add_conn return
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 117/163: url: check Curl_conncache_add_conn return code |
Date: |
Sun, 05 Aug 2018 12:37:23 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit f762fec323f36fd7da7ad6eddfbbae940ec3229e
Author: Daniel Stenberg <address@hidden>
AuthorDate: Sun Jun 24 23:22:35 2018 +0200
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
---
lib/conncache.c | 15 ++++-----------
lib/conncache.h | 4 ++--
lib/url.c | 8 ++++++--
3 files changed, 12 insertions(+), 15 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++;
diff --git a/lib/conncache.h b/lib/conncache.h
index d8ad80f96..eedd7a800 100644
--- a/lib/conncache.h
+++ b/lib/conncache.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2015 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 2015 - 2018, Daniel Stenberg, <address@hidden>, et al.
* Copyright (C) 2012 - 2014, Linus Nielsen Feltzing, <address@hidden>
*
* This software is licensed as described in the file COPYING, which
@@ -63,7 +63,7 @@ size_t Curl_conncache_bundle_size(struct connectdata *conn);
bool Curl_conncache_return_conn(struct connectdata *conn);
CURLcode Curl_conncache_add_conn(struct conncache *connc,
- struct connectdata *conn);
+ struct connectdata *conn) WARN_UNUSED_RESULT;
void Curl_conncache_remove_conn(struct connectdata *conn,
bool lock);
bool Curl_conncache_foreach(struct Curl_easy *data,
diff --git a/lib/url.c b/lib/url.c
index f1a6e8db4..27b2c1e14 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4308,7 +4308,9 @@ static CURLcode create_conn(struct Curl_easy *data,
conn->data = data;
conn->bits.tcpconnect[FIRSTSOCKET] = TRUE; /* we are "connected */
- Curl_conncache_add_conn(data->state.conn_cache, conn);
+ result = Curl_conncache_add_conn(data->state.conn_cache, conn);
+ if(result)
+ goto out;
/*
* Setup whatever necessary for a resumed transfer
@@ -4531,7 +4533,9 @@ static CURLcode create_conn(struct Curl_easy *data,
* This is a brand new connection, so let's store it in the connection
* cache of ours!
*/
- Curl_conncache_add_conn(data->state.conn_cache, conn);
+ result = Curl_conncache_add_conn(data->state.conn_cache, conn);
+ if(result)
+ goto out;
}
#if defined(USE_NTLM)
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 98/163: RELEASE-NOTES: synced, (continued)
- [GNUnet-SVN] [gnurl] 98/163: RELEASE-NOTES: synced, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 93/163: GOVERNANCE.md: explains how this project is run, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 101/163: curl-confopts.m4: fix typo from ed224f23d5beb, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 153/163: lib/curl_setup.h: remove unicode bom from 8272ec50f02, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 134/163: DEPRECATE: mention the PR that disabled axTLS, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 133/163: docs/DEPRECATE.md: spelling and minor formatting, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 143/163: CMake: Remove unused functions, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 154/163: lib/curl_setup.h: remove unicode character, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 157/163: TODO: Configurable loading of OpenSSL configuration file, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 114/163: CURLOPT_SSL_VERIFYPEER.3: fix syntax mistake, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 117/163: url: check Curl_conncache_add_conn return code,
gnunet <=
- [GNUnet-SVN] [gnurl] 144/163: CMake: Remove unused 'output_var' from 'collect_true', gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 129/163: openssl: Remove some dead code, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 150/163: schannel: make more cipher options conditional, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 162/163: gnurl: rename CURLINFO and CURLOPT section 3 manpages post-merge, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 124/163: travis: add a build using the synchronous name resolver, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 138/163: example/crawler.c: simple crawler based on libxml2, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 132/163: DEPRECATE: new doc describing planned item removals, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 135/163: DEPRECATE: linkified, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 77/163: boringssl + schannel: undef X509_NAME in lib/schannel.h, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 121/163: easy_perform: use *multi_timeout() to get wait times, gnunet, 2018/08/05