gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 01/10: memorypool: fixed MHD_pool_reset()


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 01/10: memorypool: fixed MHD_pool_reset()
Date: Mon, 17 Jun 2019 20:35:44 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit c98aa3d33472f82014e9cd80d1a3bf0ee9fe80c1
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sun Jun 16 17:49:35 2019 +0300

    memorypool: fixed MHD_pool_reset()
---
 src/microhttpd/memorypool.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 3770b8c3..a6053fb2 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -331,6 +331,7 @@ MHD_pool_reset (struct MemoryPool *pool,
 {
   mhd_assert (pool->end >= pool->pos);
   mhd_assert (pool->size >= pool->end - pool->pos);
+  mhd_assert (copy_bytes < new_size);
   mhd_assert (keep != NULL || copy_bytes == 0);
   mhd_assert (keep == NULL || pool->memory <= (uint8_t*)keep);
   mhd_assert (keep == NULL || pool->memory + pool->size >= (uint8_t*)keep + 
copy_bytes);
@@ -341,17 +342,15 @@ MHD_pool_reset (struct MemoryPool *pool,
         memmove (pool->memory,
                  keep,
                  copy_bytes);
-      keep = pool->memory;
     }
-  pool->end = pool->size;
   /* technically not needed, but safer to zero out */
   if (pool->size > copy_bytes)
     memset (&pool->memory[copy_bytes],
             0,
             pool->size - copy_bytes);
-  if (NULL != keep)
-    pool->pos = ROUND_TO_ALIGN (new_size);
-  return keep;
+  pool->pos = ROUND_TO_ALIGN (new_size);
+  pool->end = pool->size;
+  return pool->memory;
 }
 
 

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



reply via email to

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