Fix long standing bug with timestamp rewriting code for processing
authorTatsuo Ishii <ishii@postgresql.org>
Mon, 18 Mar 2013 06:58:34 +0000 (15:58 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Mon, 18 Mar 2013 06:58:34 +0000 (15:58 +0900)
commit44f4faf273de7ec88fce8e5e7b1e91f55e114bd2
tree9f7d556c63d2437b82cb77eeb17e8d84df659fc2
parent8b337a2ad5af7b4a3ce874454c34a3049876e8bc
Fix long standing bug with timestamp rewriting code for processing
extended protocol.

Parse() allocate memory using palloc() while rewriting the parse
message.  Problem is, the rewritten message was kept in the data which
is managed by pool_create_sent_message() etc. The function assumes
that all the data is in session context memory. However, palloc()
allocates memory in query context of course, and gets freeed later on
when the query context disappears. And the function tries to free the
memory as well, which causes various problems, including segfault and
double free. To fix this, memory to store rewritten message is
allocated using session context. The bug was there since pgpool-II 3.0
was born.

Problem analysis and patch contributed by Naoya Anzai.
pool_proto_modules.c