summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMAntoniak <47522782+MAntoniak@users.noreply.github.com>2021-12-16 19:31:57 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-01-02 22:53:47 +0100
commit1f31bdb10bae1071289c86d32b4d25fe6b821148 (patch)
treef2a4d1d5e7033d553bd3ea58236bedce4e85ccbf
parent78dcbe40a6cb36f5fa56c9c479989b3dca36de6d (diff)
downloadcurl-1f31bdb10bae1071289c86d32b4d25fe6b821148.tar.gz
url: reduce ssl backend count for CURL_DISABLE_PROXY builds
Closes #8212
-rw-r--r--lib/url.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/url.c b/lib/url.c
index 45b514c2b..9f1013554 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -137,6 +137,15 @@ bool curl_win32_idn_to_ascii(const char *in, char **out);
#include "curl_memory.h"
#include "memdebug.h"
+/* Count of the backend ssl objects to allocate */
+#ifdef USE_SSL
+# ifndef CURL_DISABLE_PROXY
+# define SSL_BACKEND_CNT 4
+# else
+# define SSL_BACKEND_CNT 2
+# endif
+#endif
+
static void conn_free(struct connectdata *conn);
/* Some parts of the code (e.g. chunked encoding) assume this buffer has at
@@ -1682,7 +1691,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
data becomes proxy backend data). */
{
size_t sslsize = Curl_ssl->sizeof_ssl_backend_data;
- char *ssl = calloc(4, sslsize);
+ char *ssl = calloc(SSL_BACKEND_CNT, sslsize);
if(!ssl) {
free(conn);
return NULL;