mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
test1521: fixed OOM handling
This commit is contained in:
parent
4024a0b93b
commit
916ec30a92
@ -75,9 +75,10 @@ curl_xferinfo_callback xferinfocb;
|
||||
|
||||
int test(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURL *dep;
|
||||
CURLSH *share;
|
||||
int res = 0;
|
||||
CURL *curl = NULL;
|
||||
CURL *dep = NULL;
|
||||
CURLSH *share = NULL;
|
||||
char errorbuffer[CURL_ERROR_SIZE];
|
||||
void *conv_from_network_cb = NULL;
|
||||
void *conv_to_network_cb = NULL;
|
||||
@ -87,12 +88,16 @@ int test(char *URL)
|
||||
struct curl_slist *slist=NULL;
|
||||
struct curl_httppost *httppost=NULL;
|
||||
FILE *stream = stderr;
|
||||
(void)URL; /* not used */
|
||||
dep = curl_easy_init();
|
||||
share = curl_share_init();
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct data object;
|
||||
(void)URL; /* not used */
|
||||
easy_init(dep);
|
||||
easy_init(curl);
|
||||
share = curl_share_init();
|
||||
if(!share) {
|
||||
res = CURLE_OUT_OF_MEMORY;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
(void)curl_easy_setopt(curl, CURLOPT_WRITEDATA, &object);
|
||||
(void)curl_easy_setopt(curl, CURLOPT_WRITEDATA, NULL);
|
||||
(void)curl_easy_setopt(curl, CURLOPT_URL, "string");
|
||||
@ -834,9 +839,11 @@ int test(char *URL)
|
||||
(void)curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, LO);
|
||||
(void)curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, HI);
|
||||
curl_easy_setopt(curl, 1, 0);
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_easy_cleanup(dep);
|
||||
curl_share_cleanup(share);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user