[pgpool-committers: 2798] pgpool: Fix memory leak and memory corruption in extended protocol case

Tatsuo Ishii ishii at postgresql.org
Sat Nov 7 22:29:37 JST 2015


Fix memory leak and memory corruption in extended protocol case.

pool_add_sent_message() removes existing unnamed statements/portal if
unarmed statements/portal already exists. This does not consider the
case the caller passes exiting unnamed message, rather than newly
created message. If an existing unnamed message is passed, it frees
memory allocated in the message, then save the pointer to the message,
which now has dangling pointers. The fix is comparing the address of
message and if they are equal, do nothing and return.

By the fix, now we can uncomment the call to
pool_sent_message_destroy() in pool_remove_sent_message(), which
caused memory leak.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=083722386bb9d16fc8f836badd95e6223b8ebe56

Modified Files
--------------
src/context/pool_session_context.c |   28 ++++++++++++++++++++++++++--
src/protocol/pool_proto_modules.c  |    2 +-
2 files changed, 27 insertions(+), 3 deletions(-)



More information about the pgpool-committers mailing list