[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 03/05: memorypool: fixed possible crash if
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 03/05: memorypool: fixed possible crash if failed to allocate memory on W32 |
Date: |
Thu, 13 Jun 2019 00:06:38 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit d15bd7c02f30b612a2c2776f21209a6bc8fa00b9
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Wed Jun 12 19:46:42 2019 +0300
memorypool: fixed possible crash if failed to allocate memory on W32
---
src/microhttpd/memorypool.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 843dd540..e3de5841 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -40,7 +40,9 @@
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
#define MAP_ANONYMOUS MAP_ANON
#endif
-#ifndef MAP_FAILED
+#if defined(_WIN32)
+#define MAP_FAILED NULL
+#elif ! defined(MAP_FAILED)
#define MAP_FAILED ((void*)-1)
#endif
@@ -78,7 +80,7 @@ struct MemoryPool
size_t pos;
/**
- * Offset of the last unallocated byte.
+ * Offset of the byte after the last unallocated byte.
*/
size_t end;
@@ -100,6 +102,7 @@ MHD_pool_create (size_t max)
{
struct MemoryPool *pool;
+ max = ROUND_TO_ALIGN(max);
pool = malloc (sizeof (struct MemoryPool));
if (NULL == pool)
return NULL;
--
To stop receiving notification emails like this one, please contact
address@hidden.