pgpool2.git / summary / log / commit / refs
commit e936b4fa2af98d5fec196253dd29fb9fa58b7465
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Tue Dec 20 02:38:12 2016 +0000
Fix occasional segfault when query cache is enabled.
Per bug 263.
src/query_cache/pool_memqcache.c | 2 ++
src/utils/mmgr/mcxt.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/src/query_cache/pool_memqcache.c b/src/query_cache/pool_memqcache.c
index 338d9b8eb..8940747e8 100644
--- a/src/query_cache/pool_memqcache.c
+++ b/src/query_cache/pool_memqcache.c
@@ -3071,6 +3071,8 @@ static void pool_check_and_discard_cache_buffer(int num_oids, int *oids)
continue;
soids = (int *)pool_get_buffer(cache->oids, &len);
+ if (!soids || !len)
+ continue;
for(j=0;j<cache->num_oids;j++)
{
diff --git a/src/utils/mmgr/mcxt.c b/src/utils/mmgr/mcxt.c
index a1a490f36..0eae52012 100644
--- a/src/utils/mmgr/mcxt.c
+++ b/src/utils/mmgr/mcxt.c
@@ -703,6 +703,9 @@ pfree(void *pointer)
Assert(pointer != NULL);
Assert(pointer == (void *) MAXALIGN(pointer));
+ if (pointer == NULL)
+ return;
+
/*
* OK, it's probably safe to look at the chunk header.
*/
[parent: 7087e257ff6f]