diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2001-02-22 23:41:15 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2001-02-22 23:41:15 +0000 | 
| commit | 9c63fcf21002256c338f2fe8dde34a5dc43d9a4e (patch) | |
| tree | 6d0f0ee8bec739ad37616c90b4a0e821c3c3a29c /lib | |
| parent | 1f17fb5f895dc668ef961935a9bdc378eea8d22b (diff) | |
we only allocate the HTTP struct if we need to
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/http.c | 14 | 
1 files changed, 9 insertions, 5 deletions
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) {  | 
