]> granicus.if.org Git - curl/commitdiff
url: let CURLOPT_BUFFERSIZE realloc to smaller sizes too
authorDaniel Stenberg <daniel@haxx.se>
Sun, 30 Apr 2017 22:31:56 +0000 (00:31 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 1 May 2017 22:04:52 +0000 (00:04 +0200)
Closes #1449

lib/url.c

index e018927c056959458189e2d0fb6d01a015cbd48e..a2e8902f1e69d147fa56a5d98af4ecb2e3a7757a 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -2298,8 +2298,8 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
     else if(arg < READBUFFER_MIN)
       arg = READBUFFER_MIN;
 
-    /* Resize only if larger than default buffer size. */
-    if(arg > READBUFFER_SIZE) {
+    /* Resize if new size */
+    if(arg != data->set.buffer_size) {
       char *newbuff = realloc(data->state.buffer, arg + 1);
       if(!newbuff) {
         DEBUGF(fprintf(stderr, "Error: realloc of buffer failed\n"));