Call curl_global_cleanup() in all code paths before exiting test

This commit is contained in:
Yang Tse 2006-10-10 23:50:37 +00:00
parent 083a84e5d0
commit 8274447dd9
4 changed files with 13 additions and 5 deletions

View File

@ -45,9 +45,11 @@ int test(char *URL)
/* get a curl handle */
curl = curl_easy_init();
if(!curl)
if(!curl) {
fclose(hd_src);
curl_global_cleanup();
return 100; /* major bad */
}
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ;

View File

@ -51,8 +51,10 @@ int test(char *URL)
/* get NUM_HANDLES easy handles */
for(i=0; i < NUM_HANDLES; i++) {
curl[i] = curl_easy_init();
if(!curl[i])
if(!curl[i]) {
curl_global_cleanup();
return 100 + i; /* major bad */
}
curl_easy_setopt(curl[i], CURLOPT_URL, URL);
/* go verbose */

View File

@ -32,8 +32,10 @@ int test(char *URL)
/* get NUM_HANDLES easy handles */
for(i=0; i < NUM_HANDLES; i++) {
curl[i] = curl_easy_init();
if(!curl[i])
if(!curl[i]) {
curl_global_cleanup();
return 100 + i; /* major bad */
}
curl_easy_setopt(curl[i], CURLOPT_URL, URL);
/* go verbose */

View File

@ -29,8 +29,10 @@ int test(char *URL)
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(!curl)
if(!curl) {
curl_global_cleanup();
return 100; /* major bad */
}
curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);