]> granicus.if.org Git - curl/commitdiff
https.c example: remember to call curl_global_init()
authorKamil Dudka <kdudka@redhat.com>
Mon, 1 Oct 2012 09:20:11 +0000 (11:20 +0200)
committerKamil Dudka <kdudka@redhat.com>
Mon, 1 Oct 2012 09:23:51 +0000 (11:23 +0200)
... in order not to leak memory on initializing an SSL library.

Reported by: Tomas Mlcoch

docs/examples/https.c

index 96225b597bbb9912d9872d9131346304b4fdcb3f..bd9a33ba6dbfc17c04f6399577e835b2ed24270c 100644 (file)
@@ -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;
 }