aboutsummaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-01-20 12:52:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-01-20 12:52:34 +0000
commit5a83976c996a33283c3aca29de86d77a238429b9 (patch)
tree0a00ee65223437c65b4b6f5bd9d56d9022d18aa6 /lib/transfer.c
parentb5276a9a69bd29502b5a8d6711f4c2d94f4c445e (diff)
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.
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c6
1 files changed, 6 insertions, 0 deletions
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;