freecwmp
[Top] [All Lists]

[PATCH] check curl error code in http_send_message

To: freecwmp@linux-mips.org
Subject: [PATCH] check curl error code in http_send_message
From: Kaspar Schleiser <kaspar@schleiser.de>
Date: Wed, 11 Apr 2012 14:25:56 +0200
Cc: Kaspar Schleiser <kaspar@schleiser.de>
Original-recipient: rfc822;freecwmp@linux-mips.org
Sender: freecwmp-bounce@linux-mips.org
Hi,

http_send_message doesn't recognise curl reporting an error.

Signed-off-by: Kaspar Schleiser <kaspar@schleiser.de>
---
 src/http/http.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/http/http.c b/src/http/http.c
index 255cf45..44a1960 100644
--- a/src/http/http.c
+++ b/src/http/http.c
@@ -240,13 +240,16 @@ http_send_message(char *msg_out, char **msg_in)
        *msg_in = (char *) calloc (1, sizeof(char));
 
        res = curl_easy_perform(curl);
+       curl_easy_cleanup(curl);
+
+       if (res)
+               goto error;
 
        if (!strlen(*msg_in)) {
                free(*msg_in);
                *msg_in = NULL;
        }
 
-       curl_easy_cleanup(curl);
 #endif /* HTTP_CURL */
 
 #ifdef HTTP_ZSTREAM
-- 
1.7.9.5


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] check curl error code in http_send_message, Kaspar Schleiser <=