Skip to content

Commit 042c5f7

Browse files
Mark global flag for curl isInit as false on Shutdown
1 parent dd0d976 commit 042c5f7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -506,17 +506,23 @@ void CurlHttpClient::InitGlobalState()
506506
<< ", ssl version: " << curlVersionData->ssl_version);
507507
isInit = true;
508508
#ifdef USE_AWS_MEMORY_MANAGEMENT
509-
curl_global_init_mem(CURL_GLOBAL_ALL, &malloc_callback, &free_callback, &realloc_callback, &strdup_callback, &calloc_callback);
509+
CURLcode curlResponseCode = curl_global_init_mem(CURL_GLOBAL_ALL, &malloc_callback, &free_callback, &realloc_callback, &strdup_callback, &calloc_callback);
510510
#else
511-
curl_global_init(CURL_GLOBAL_ALL);
511+
CURLcode curlResponseCode = curl_global_init(CURL_GLOBAL_ALL);
512512
#endif
513+
if (curlResponseCode != CURLE_OK)
514+
{
515+
AWS_LOGSTREAM_FATAL(CURL_HTTP_CLIENT_TAG, "Failed to init curl, return code " << curlResponseCode);
516+
isInit = false;
517+
}
513518
}
514519
}
515520

516521

517522
void CurlHttpClient::CleanupGlobalState()
518523
{
519524
curl_global_cleanup();
525+
isInit = false;
520526
}
521527

522528
Aws::String CurlInfoTypeToString(curl_infotype type)

0 commit comments

Comments
 (0)