From: Kamil Dudka Date: Mon, 1 Oct 2012 09:20:11 +0000 (+0200) Subject: https.c example: remember to call curl_global_init() X-Git-Tag: curl-7_28_0~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c01b6f4d098347ddfa3ece4ac33d6cc0607b79dd;p=thirdparty%2Fcurl.git https.c example: remember to call curl_global_init() ... in order not to leak memory on initializing an SSL library. Reported by: Tomas Mlcoch --- diff --git a/docs/examples/https.c b/docs/examples/https.c index 96225b597b..bd9a33ba6d 100644 --- a/docs/examples/https.c +++ b/docs/examples/https.c @@ -27,6 +27,8 @@ int main(void) CURL *curl; CURLcode res; + curl_global_init(CURL_GLOBAL_DEFAULT); + curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); @@ -65,5 +67,8 @@ int main(void) /* always cleanup */ curl_easy_cleanup(curl); } + + curl_global_cleanup(); + return 0; }