gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnurl] 94/116: Curl_open: fix OOM return error correctly


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 94/116: Curl_open: fix OOM return error correctly
Date: Tue, 05 Dec 2017 14:52:04 +0100

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

ng0 pushed a commit to branch master
in repository gnurl.

commit 9554c3c6e56e23153d4e1025b62c7a6402464a7c
Author: Daniel Stenberg <address@hidden>
AuthorDate: Mon Nov 20 23:16:56 2017 +0100

    Curl_open: fix OOM return error correctly
    
    Closes #2098
---
 lib/url.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/lib/url.c b/lib/url.c
index d2208d5eb..d0b9c7ef0 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -569,32 +569,31 @@ CURLcode Curl_open(struct Curl_easy **curl)
     DEBUGF(fprintf(stderr, "Error: malloc of buffer failed\n"));
     result = CURLE_OUT_OF_MEMORY;
   }
-
-  Curl_mime_initpart(&data->set.mimepost, data);
-
-  data->state.headerbuff = malloc(HEADERSIZE);
-  if(!data->state.headerbuff) {
-    DEBUGF(fprintf(stderr, "Error: malloc of headerbuff failed\n"));
-    result = CURLE_OUT_OF_MEMORY;
-  }
   else {
-    result = Curl_init_userdefined(&data->set);
-
-    data->state.headersize = HEADERSIZE;
+    Curl_mime_initpart(&data->set.mimepost, data);
 
-    Curl_convert_init(data);
+    data->state.headerbuff = malloc(HEADERSIZE);
+    if(!data->state.headerbuff) {
+      DEBUGF(fprintf(stderr, "Error: malloc of headerbuff failed\n"));
+      result = CURLE_OUT_OF_MEMORY;
+    }
+    else {
+      result = Curl_init_userdefined(&data->set);
 
-    Curl_initinfo(data);
+      data->state.headersize = HEADERSIZE;
+      Curl_convert_init(data);
+      Curl_initinfo(data);
 
-    /* most recent connection is not yet defined */
-    data->state.lastconnect = NULL;
+      /* most recent connection is not yet defined */
+      data->state.lastconnect = NULL;
 
-    data->progress.flags |= PGRS_HIDE;
-    data->state.current_speed = -1; /* init to negative == impossible */
-    data->set.fnmatch = ZERO_NULL;
-    data->set.maxconnects = DEFAULT_CONNCACHE_SIZE; /* for easy handles */
+      data->progress.flags |= PGRS_HIDE;
+      data->state.current_speed = -1; /* init to negative == impossible */
+      data->set.fnmatch = ZERO_NULL;
+      data->set.maxconnects = DEFAULT_CONNCACHE_SIZE; /* for easy handles */
 
-    Curl_http2_init_state(&data->state);
+      Curl_http2_init_state(&data->state);
+    }
   }
 
   if(result) {

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



reply via email to

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