pgpool: Fix query cache when pgpool is built without memcached.

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgpool-committers(at)lists(dot)postgresql(dot)org
Subject: pgpool: Fix query cache when pgpool is built without memcached.
Date: 2025-09-05 09:20:04
Message-ID: E1uuSc0-00BfN2-19@gothos.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-committers

Fix query cache when pgpool is built without memcached.

When configure is not provided --with-memcached, compiler error
occured.

query_cache/pool_memqcache.c:542:17: 警告: 'free' called on pointer 'cih' with nonzero offset 24 -Wfree-nonheap-objec
t]
542 | free(ptr);
| ^~~~~~~~~
query_cache/pool_memqcache.c:2843:15: 備考: returned from 'pool_cache_item_header'
2843 | cih = pool_cache_item_header(cacheid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is caused by the code block:
if (!pool_is_shmem_cache())
{
free(ptr);
}

The compiler thought that "ptr" could be the value returned by
pool_cache_item_header(), because the compiler does not understand
pool_is_shmem_cache() could return false only when memcached is
enabled. To fix this, surround the code block above with #ifdef
USE_MEMCACHED.

Reported-by: Bo Peng <pengbo(at)sraoss(dot)co(dot)jp>
Backpatch-through: v4.2

Branch
------
V4_2_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=27ba379cdc326d1e3040d459fad4e547a5d35b20

Modified Files
--------------
src/query_cache/pool_memqcache.c | 2 ++
1 file changed, 2 insertions(+)

Browse pgpool-committers by date

  From Date Subject
Next Message Tatsuo Ishii 2025-09-05 09:20:10 pgpool: Fix query cache when pgpool is built without memcached.
Previous Message Tatsuo Ishii 2025-09-04 08:12:06 pgpool: Fix query cache lock file handling.