mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 09:21:50 -05:00
test585: Fixed NULL pointer dereference in fopen
This commit is contained in:
parent
3d77d013e1
commit
c303107345
@ -91,43 +91,44 @@ int test(char *URL)
|
|||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
|
|
||||||
if(!res) {
|
if(!res) {
|
||||||
FILE *moo;
|
|
||||||
res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ipstr);
|
res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ipstr);
|
||||||
moo = fopen(libtest_arg2, "wb");
|
if (libtest_arg2) {
|
||||||
if(moo) {
|
FILE *moo = fopen(libtest_arg2, "wb");
|
||||||
double time_namelookup;
|
if(moo) {
|
||||||
double time_connect;
|
double time_namelookup;
|
||||||
double time_pretransfer;
|
double time_connect;
|
||||||
double time_starttransfer;
|
double time_pretransfer;
|
||||||
double time_total;
|
double time_starttransfer;
|
||||||
fprintf(moo, "IP: %s\n", ipstr);
|
double time_total;
|
||||||
curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup);
|
fprintf(moo, "IP: %s\n", ipstr);
|
||||||
curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect);
|
curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup);
|
||||||
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer);
|
curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect);
|
||||||
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
|
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer);
|
||||||
&time_starttransfer);
|
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
|
||||||
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total);
|
&time_starttransfer);
|
||||||
|
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total);
|
||||||
|
|
||||||
/* since the timing will always vary we only compare relative differences
|
/* since the timing will always vary we only compare relative differences
|
||||||
between these 5 times */
|
between these 5 times */
|
||||||
if(time_namelookup > time_connect) {
|
if(time_namelookup > time_connect) {
|
||||||
fprintf(moo, "namelookup vs connect: %f %f\n",
|
fprintf(moo, "namelookup vs connect: %f %f\n",
|
||||||
time_namelookup, time_connect);
|
time_namelookup, time_connect);
|
||||||
}
|
}
|
||||||
if(time_connect > time_pretransfer) {
|
if(time_connect > time_pretransfer) {
|
||||||
fprintf(moo, "connect vs pretransfer: %f %f\n",
|
fprintf(moo, "connect vs pretransfer: %f %f\n",
|
||||||
time_connect, time_pretransfer);
|
time_connect, time_pretransfer);
|
||||||
}
|
}
|
||||||
if(time_pretransfer > time_starttransfer) {
|
if(time_pretransfer > time_starttransfer) {
|
||||||
fprintf(moo, "pretransfer vs starttransfer: %f %f\n",
|
fprintf(moo, "pretransfer vs starttransfer: %f %f\n",
|
||||||
time_pretransfer, time_starttransfer);
|
time_pretransfer, time_starttransfer);
|
||||||
}
|
}
|
||||||
if(time_starttransfer > time_total) {
|
if(time_starttransfer > time_total) {
|
||||||
fprintf(moo, "starttransfer vs total: %f %f\n",
|
fprintf(moo, "starttransfer vs total: %f %f\n",
|
||||||
time_starttransfer, time_total);
|
time_starttransfer, time_total);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(moo);
|
fclose(moo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user