mirror of https://github.com/moparisthebest/curl
check malloc() return code
This commit is contained in:
parent
9e31a0536e
commit
08d1da106e
|
@ -1430,7 +1430,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||||
char *newurl;
|
char *newurl;
|
||||||
|
|
||||||
newurl = malloc(urllen + newlen - currlen + 1);
|
newurl = malloc(urllen + newlen - currlen + 1);
|
||||||
|
if(newurl) {
|
||||||
/* copy the part before the host name */
|
/* copy the part before the host name */
|
||||||
memcpy(newurl, url, ptr - url);
|
memcpy(newurl, url, ptr - url);
|
||||||
/* append the new host name instead of the old */
|
/* append the new host name instead of the old */
|
||||||
|
@ -1444,6 +1444,9 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||||
data->change.url = newurl;
|
data->change.url = newurl;
|
||||||
data->change.url_alloc = TRUE;
|
data->change.url_alloc = TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ppath = data->change.url;
|
ppath = data->change.url;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue