we only allocate the HTTP struct if we need to

This commit is contained in:
Daniel Stenberg 2001-02-22 23:41:15 +00:00
Родитель 1f17fb5f89
Коммит 9c63fcf210
1 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -390,11 +390,15 @@ CURLcode Curl_http(struct connectdata *conn)
char *host = conn->name;
long *bytecount = &conn->bytecount;
http = (struct HTTP *)malloc(sizeof(struct HTTP));
if(!http)
return CURLE_OUT_OF_MEMORY;
memset(http, 0, sizeof(struct HTTP));
conn->proto.http = http;
if(!conn->proto.http) {
/* Only allocate this struct if we don't already have it! */
http = (struct HTTP *)malloc(sizeof(struct 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)) &&
data->bits.upload) {