aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-11-30 14:45:20 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-11-30 15:06:13 +0000
commit785d76d681fecffd8941159daeef6fda0877a208 (patch)
treee9dbaf78ec5c4e9e9707e056638e6df2b0f5364a
parent9afd97022eb3ff586b13d33a7d85ce502d06e93c (diff)
transfer: Fixed existing scratch buffer being checked for NULL twice
If the scratch buffer already existed when the CRLF conversion was performed then the buffer pointer would be checked twice for NULL. This second check is only necessary if the call to malloc() was performed by the first check.
-rw-r--r--lib/transfer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 84a7e2be4..2cc7f7881 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -910,11 +910,12 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
(data->set.prefer_ascii) ||
#endif
(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;
+ data->state.scratch = malloc(2*BUFSIZE);
+ if(data->state.scratch == NULL) {
+ failf (data, "Failed to alloc scratch buffer!");
+ return CURLE_OUT_OF_MEMORY;
+ }
}
/*
* ASCII/EBCDIC Note: This is presumably a text (not binary)