libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit c2b4cb4a968b8d2dc291cda5ae48f872f63e1256
parent 4524fbe23f82662ab80107a430fc0384cd2230c7
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sat,  9 Oct 2021 17:25:11 +0300

MemoryPool: realloc: do not move old buffer pointer even if buffer size is zero

Diffstat:
Msrc/microhttpd/memorypool.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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);