From 5a83976c996a33283c3aca29de86d77a238429b9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 20 Jan 2003 12:52:34 +0000 Subject: Markus F.X.J. Oberhumer's patch that reduces memory usage quite a bit by only allocating the scratch memory buffer once it is needed and not always in the handle. --- lib/transfer.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/transfer.c') diff --git a/lib/transfer.c b/lib/transfer.c index 02eb7e206..1e3fafc8d 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -964,6 +964,12 @@ CURLcode Curl_readwrite(struct connectdata *conn, /* convert LF to CRLF if so asked */ if (data->set.crlf) { + if(data->state.scratch == NULL) + data->state.scratch = malloc(2*BUFSIZE); + if(data->state.scratch == NULL) { + failf (data, "Failed to alloc scratch buffer!"); + return CURLE_OUT_OF_MEMORY; + } for(i = 0, si = 0; i < nread; i++, si++) { if (conn->upload_fromhere[i] == 0x0a) { data->state.scratch[si++] = 0x0d; -- cgit v1.2.3