gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] 39/254: url: fixed a memory leak on OOM while setti


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 39/254: url: fixed a memory leak on OOM while setting CURLOPT_BUFFERSIZE
Date: Sat, 17 Jun 2017 16:51:11 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.

commit 12e7a8c3d609d6a6094a7db8fb8c0cc80d8f55f0
Author: Dan Fandrich <address@hidden>
AuthorDate: Sat Apr 29 18:52:51 2017 +0200

    url: fixed a memory leak on OOM while setting CURLOPT_BUFFERSIZE
---
 lib/url.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/url.c b/lib/url.c
index f5998d6b1..4fc2f4cad 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2293,12 +2293,13 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption 
option,
 
     /* Resize only if larger than default buffer size. */
     if(data->set.buffer_size > BUFSIZE) {
-      data->state.buffer = realloc(data->state.buffer,
-                                   data->set.buffer_size + 1);
-      if(!data->state.buffer) {
+      char *newbuff = realloc(data->state.buffer, data->set.buffer_size + 1);
+      if(!newbuff) {
         DEBUGF(fprintf(stderr, "Error: realloc of buffer failed\n"));
         result = CURLE_OUT_OF_MEMORY;
       }
+      else
+        data->state.buffer = newbuff;
     }
 
     break;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]