From f390f70af004f25ab43c54862d728cbcb57e1966 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Tue, 20 Dec 2016 11:38:12 +0900 Subject: [PATCH] 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 06ce6b9da..b78169325 100644 --- a/src/query_cache/pool_memqcache.c +++ b/src/query_cache/pool_memqcache.c @@ -3089,6 +3089,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;jnum_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. */ -- 2.39.5