https.c example: remember to call curl_global_init()
... in order not to leak memory on initializing an SSL library. Reported by: Tomas Mlcoch
This commit is contained in:
parent
9da2c96039
commit
c01b6f4d09
@ -27,6 +27,8 @@ int main(void)
|
|||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
|
||||||
|
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
|
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
if(curl) {
|
if(curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||||
@ -65,5 +67,8 @@ int main(void)
|
|||||||
/* always cleanup */
|
/* always cleanup */
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curl_global_cleanup();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user