Fix "unable to bind. cannot get parse message" error.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Fri, 9 Aug 2019 08:04:28 +0000 (17:04 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Fri, 9 Aug 2019 08:17:31 +0000 (17:17 +0900)
commitc896d21fb67ca0f649fd48c55017f4a6f9407d01
tree3b546f663d9bc302e8903f8757d1d9a0d3f3fdb6
parent0da529250b67fddc04c2ca4290b12a7a29dbf6b5
Fix "unable to bind. cannot get parse message" error.

This was caused by too-eager memory free in parse_before_bind. It
called
pool_remove_sent_message/pool_create_sent_message/pool_add_sent_message
combo to replace the query context in the sent message. Unfortunately
pool_remove_sent_message free memory such as statement name, which was
being passed by caller. As a result, the new sent message created by
pool_create_sent_message pointed to freed statement name, which may
make a search by statement name fail because now the statement name in
the sent message points to freed memory area, which might be
overwritten by later memory allocation. Fix is, instead of calling
pool_remove_sent_message etc., just replace the query context in the
sent message.

Per bug 531.
src/protocol/pool_proto_modules.c