Fix accessing already freed data in extended query.
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 13 Jul 2018 08:36:00 +0000 (17:36 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 13 Jul 2018 08:36:00 +0000 (17:36 +0900)
commit45d17b1f1b60d3980b842f4da8d1a3d141db6561
treed9cd1db37f7c2f6d135dd72d60a82646862cc00d
parent27a00560b098868ccc2ac893b76732a51006ac9b
Fix accessing already freed data in extended query.

When previous_message was set and accessed later on, it looked into
already freed data. This is because read_kind_from_backend() set the
pointer to the previous message in session context, and then released
the memory at the end of the function. No report from fields so far. I
just found this while testing Pgpool-II.

To fix this, store the previous message in the session context, rather
than storing the pointer. Also have a flag in the session context to
indicate whether a previous message is actually stored or not.

All the API for previous message has not been changed.
src/context/pool_session_context.c
src/include/context/pool_session_context.h