mirror of
https://github.com/curl/curl.git
synced 2025-09-17 17:42:49 +03:00
make it not leak memory when it returns prematurely
This commit is contained in:
parent
c090fdbdf1
commit
eb946690d2
|
@ -161,7 +161,7 @@ int test(char *URL)
|
||||||
CURLM* multi;
|
CURLM* multi;
|
||||||
sslctxparm p;
|
sslctxparm p;
|
||||||
|
|
||||||
int i;
|
int i = 0;
|
||||||
CURLMsg *msg;
|
CURLMsg *msg;
|
||||||
|
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
@ -211,7 +211,8 @@ int test(char *URL)
|
||||||
|
|
||||||
if (res != CURLM_OK) {
|
if (res != CURLM_OK) {
|
||||||
fprintf(stderr, "not okay???\n");
|
fprintf(stderr, "not okay???\n");
|
||||||
return 80;
|
i = 80;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FD_ZERO(&rd);
|
FD_ZERO(&rd);
|
||||||
|
@ -221,18 +222,21 @@ int test(char *URL)
|
||||||
|
|
||||||
if (curl_multi_fdset(multi, &rd, &wr, &exc, &max_fd) != CURLM_OK) {
|
if (curl_multi_fdset(multi, &rd, &wr, &exc, &max_fd) != CURLM_OK) {
|
||||||
fprintf(stderr, "unexpected failured of fdset.\n");
|
fprintf(stderr, "unexpected failured of fdset.\n");
|
||||||
return 89;
|
i = 89;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
|
if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
|
||||||
fprintf(stderr, "bad select??\n");
|
fprintf(stderr, "bad select??\n");
|
||||||
return 95;
|
i =95;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CURLM_CALL_MULTI_PERFORM;
|
res = CURLM_CALL_MULTI_PERFORM;
|
||||||
}
|
}
|
||||||
msg = curl_multi_info_read(multi, &running);
|
msg = curl_multi_info_read(multi, &running);
|
||||||
/* this should now contain a result code from the easy handle, get it */
|
/* this should now contain a result code from the easy handle, get it */
|
||||||
|
if(msg)
|
||||||
i = msg->data.result;
|
i = msg->data.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user