Hi,

here are two minor fixes to succeed the Gitlab CI.

Regards, Tim
From ce96294b334ec3f34a68a4ae6f2caa2bd761441e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]>
Date: Sun, 14 Apr 2019 18:13:06 +0200
Subject: [PATCH 1/2] Fix memleak in example

---
 src/examples/http_chunked_compression.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/examples/http_chunked_compression.c b/src/examples/http_chunked_compression.c
index 167771fa..36b3e1fd 100644
--- a/src/examples/http_chunked_compression.c
+++ b/src/examples/http_chunked_compression.c
@@ -101,8 +101,8 @@ read_cb (void *cls, uint64_t pos, char *mem, size_t size)
   else
     {
       memcpy (mem, buf, size);
-      free (buf);
     }
+  free (buf); // buf may be set even on error return
 done:
   free (src);
   return size;
-- 
2.20.1

From ed88973b613b495331e75741c08fa2170873adc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]>
Date: Sun, 14 Apr 2019 18:14:23 +0200
Subject: [PATCH 2/2] Narrow scope of variable to succeed scan-build

---
 src/microhttpd/connection.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 4fe66805..8b136b83 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2272,7 +2272,6 @@ parse_initial_message_line (struct MHD_Connection *connection,
   char *http_version;
   char *args;
   unsigned int unused_num_headers;
-  size_t uri_len;
 
   if (NULL == (uri = memchr (line,
                              ' ',
@@ -2290,13 +2289,13 @@ parse_initial_message_line (struct MHD_Connection *connection,
     {
       /* No URI and no http version given */
       curi = "";
-      uri_len = 0;
       uri = NULL;
       connection->version = "";
       args = NULL;
     }
   else
     {
+      size_t uri_len;
       curi = uri;
       /* Search from back to accept misformed URI with space */
       http_version = line + line_len - 1;
@@ -2344,7 +2343,7 @@ parse_initial_message_line (struct MHD_Connection *connection,
   				    uri,
                                     connection);
     }
-  
+
   if (NULL != args)
     {
       args[0] = '\0';
@@ -2356,7 +2355,7 @@ parse_initial_message_line (struct MHD_Connection *connection,
 			    &connection_add_header,
 			    &unused_num_headers);
     }
-  
+
   /* unescape URI *after* searching for arguments and log callback */
   if (NULL != uri)
     daemon->unescape_callback (daemon->unescape_callback_cls,
-- 
2.20.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to