Commit 9c63fcf2 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

we only allocate the HTTP struct if we need to

parent 1f17fb5f
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -390,11 +390,15 @@ CURLcode Curl_http(struct connectdata *conn)
  char *host = conn->name;
  long *bytecount = &conn->bytecount;

  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) {