Handle null return from curl_easy_init

This commit is contained in:
Michał Trojnara
2025-06-19 14:26:40 +02:00
parent d65a2b5286
commit 772bc22c94

View File

@ -627,6 +627,10 @@ static BIO *bio_get_http_curl(long *http_code, char *url, BIO *req, char *proxy,
/* Start a libcurl easy session and set options for a curl easy handle */ /* Start a libcurl easy session and set options for a curl easy handle */
printf("Connecting to %s\n", url); printf("Connecting to %s\n", url);
curl = curl_easy_init(); curl = curl_easy_init();
if (!curl) {
fprintf(stderr, "CURL initialization failed\n");
return NULL; /* FAILED */
}
if (proxy) { if (proxy) {
res = curl_easy_setopt(curl, CURLOPT_PROXY, proxy); res = curl_easy_setopt(curl, CURLOPT_PROXY, proxy);
if (res != CURLE_OK) { if (res != CURLE_OK) {