From 9a8981241ebf07de874329bcec622f768f6befdf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 12 Jan 2021 02:49:51 +0100 Subject: [PATCH] Check return value of curl_easy_init() Normally it is not supposed to fail, but still try not to crash if it does. --- src/common/webrequest_curl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/webrequest_curl.cpp b/src/common/webrequest_curl.cpp index 52d3af48f6..21f2832c77 100644 --- a/src/common/webrequest_curl.cpp +++ b/src/common/webrequest_curl.cpp @@ -162,6 +162,12 @@ wxWebRequestCURL::wxWebRequestCURL(wxWebSession & session, m_headerList = NULL; m_handle = curl_easy_init(); + if ( !m_handle ) + { + wxStrlcpy(m_errorBuffer, "libcurl initialization failed", CURL_ERROR_SIZE); + return; + } + // Set error buffer to get more detailed CURL status m_errorBuffer[0] = '\0'; curl_easy_setopt(m_handle, CURLOPT_ERRORBUFFER, m_errorBuffer);