fix OOM handling in pool_malloc, which could lead to invalid pools and potential crash

7 weeks ago

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 10 Feb 2025 17:44:51 +0100 (7 weeks ago)
changeset 578
eb48f716b31c
parent 577
4f5ccaea4a92
child 579
e10457d74fe1

fix OOM handling in pool_malloc, which could lead to invalid pools and potential crash

src/server/util/pool.c file | annotate | diff | comparison | revisions
--- a/src/server/util/pool.c	Sat Feb 01 09:23:14 2025 +0100
+++ b/src/server/util/pool.c	Mon Feb 10 17:44:51 2025 +0100
@@ -561,7 +561,6 @@
             blocksize = pool_config.block_size;
 
         curr_block = _create_block(pool, blocksize);
-        pool->curr_block = curr_block;
 
         if (curr_block == NULL) {
             //ereport(LOG_CATASTROPHE,
@@ -569,6 +568,8 @@
             //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
             return NULL;
         }
+        
+        pool->curr_block = curr_block;
 
         ptr = curr_block->start;
         curr_block->start += reqsize;

mercurial