mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 16:18:48 -05:00
we only allocate the HTTP struct if we need to
This commit is contained in:
parent
1f17fb5f89
commit
9c63fcf210
14
lib/http.c
14
lib/http.c
@ -390,11 +390,15 @@ CURLcode Curl_http(struct connectdata *conn)
|
|||||||
char *host = conn->name;
|
char *host = conn->name;
|
||||||
long *bytecount = &conn->bytecount;
|
long *bytecount = &conn->bytecount;
|
||||||
|
|
||||||
http = (struct HTTP *)malloc(sizeof(struct HTTP));
|
if(!conn->proto.http) {
|
||||||
if(!http)
|
/* Only allocate this struct if we don't already have it! */
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
memset(http, 0, sizeof(struct HTTP));
|
http = (struct HTTP *)malloc(sizeof(struct HTTP));
|
||||||
conn->proto.http = http;
|
if(!http)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
memset(http, 0, sizeof(struct HTTP));
|
||||||
|
conn->proto.http = http;
|
||||||
|
}
|
||||||
|
|
||||||
if ( (conn->protocol&(PROT_HTTP|PROT_FTP)) &&
|
if ( (conn->protocol&(PROT_HTTP|PROT_FTP)) &&
|
||||||
data->bits.upload) {
|
data->bits.upload) {
|
||||||
|
Loading…
Reference in New Issue
Block a user