gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (a3c8bf22 -> c2b4cb4a)


From: gnunet
Subject: [libmicrohttpd] branch master updated (a3c8bf22 -> c2b4cb4a)
Date: Sun, 10 Oct 2021 20:51:03 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from a3c8bf22 A small addition for 5bcd843d0b74ba924a5dbee9d6b64ee213ec9e7f
     new 4524fbe2 Added missing update of connection's read buffer size
     new c2b4cb4a MemoryPool: realloc: do not move old buffer pointer even if 
buffer size is zero

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/connection.c | 15 +++++++++++----
 src/microhttpd/memorypool.c |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 536bb28f..654e4192 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3683,10 +3683,17 @@ MHD_connection_handle_read (struct MHD_Connection 
*connection)
 #endif /* UPGRADE_SUPPORT */
   default:
     /* shrink read buffer to how much is actually used */
-    MHD_pool_reallocate (connection->pool,
-                         connection->read_buffer,
-                         connection->read_buffer_size,
-                         connection->read_buffer_offset);
+    if ((0 != connection->read_buffer_size) &&
+        (connection->read_buffer_size != connection->read_buffer_offset))
+    {
+      mhd_assert (NULL != connection->read_buffer);
+      connection->read_buffer =
+        MHD_pool_reallocate (connection->pool,
+                             connection->read_buffer,
+                             connection->read_buffer_size,
+                             connection->read_buffer_offset);
+      connection->read_buffer_size = connection->read_buffer_offset;
+    }
     break;
   }
   return;
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 0f71ab1b..ffcaab43 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -425,7 +425,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
               (size_t) (((uint8_t*) old) - pool->memory) + old_size <= \
               pool->end - _MHD_RED_ZONE_SIZE);
 
-  if (0 != old_size)
+  if (NULL != old)
   {   /* Have previously allocated data */
     const size_t old_offset = (uint8_t*) old - pool->memory;
     const bool shrinking = (old_size > new_size);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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