aboutsummaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2012-10-01 11:20:11 +0200
committerKamil Dudka <kdudka@redhat.com>2012-10-01 11:23:51 +0200
commitc01b6f4d098347ddfa3ece4ac33d6cc0607b79dd (patch)
treee571672b63b667b0ed440e2c6a05aa9746094be8 /docs/examples
parent9da2c960391bd8e65fe23b498693b2aa1fb5005f (diff)
https.c example: remember to call curl_global_init()
... in order not to leak memory on initializing an SSL library. Reported by: Tomas Mlcoch
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/https.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/examples/https.c b/docs/examples/https.c
index 96225b597..bd9a33ba6 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;
}