From: Daniel Stenberg Date: Thu, 22 Feb 2001 23:41:15 +0000 (+0000) Subject: we only allocate the HTTP struct if we need to X-Git-Tag: curl-7_7_alpha2~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c63fcf21002256c338f2fe8dde34a5dc43d9a4e;p=curl we only allocate the HTTP struct if we need to --- diff --git a/lib/http.c b/lib/http.c index 3184c7f5f..641373ae2 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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) {