Check return value of curl_easy_init()

Normally it is not supposed to fail, but still try not to crash if it
does.
This commit is contained in:
Vadim Zeitlin
2021-01-12 02:49:51 +01:00
parent 468a961426
commit 9a8981241e

View File

@@ -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);