From: Tatsuo Ishii Date: Wed, 16 Aug 2017 04:40:46 +0000 (+0900) Subject: Fix core dump and mishandling of temp tables. X-Git-Tag: V3_7_0_BETA1~53 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=9f1acea4e6b1b4889f0640d0517e4f46de32b60a;p=pgpool2.git Fix core dump and mishandling of temp tables. Fix two issues: 1) Protect pool_remove_sent_message() and pool_get_sent_message() against null parameters. 2) Fix bug while determining if the created table is temporary or not. --- diff --git a/src/context/pool_session_context.c b/src/context/pool_session_context.c index c651fcdea..2e93985a6 100644 --- a/src/context/pool_session_context.c +++ b/src/context/pool_session_context.c @@ -346,6 +346,9 @@ bool pool_remove_sent_message(char kind, const char *name) int i; POOL_SENT_MESSAGE_LIST *msglist; + if (kind == 0 || name == NULL) + return false; + msglist = &pool_get_session_context(false)->message_list; for (i = 0; i < msglist->size; i++) @@ -574,6 +577,9 @@ POOL_SENT_MESSAGE *pool_get_sent_message(char kind, const char *name, POOL_SENT_ msglist = &pool_get_session_context(false)->message_list; + if (kind == 0 || name == NULL) + return NULL; + for (i = 0; i < msglist->size; i++) { if (msglist->sent_messages[i]->kind == kind && diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c index aaf75fccf..d02955646 100644 --- a/src/protocol/pool_proto_modules.c +++ b/src/protocol/pool_proto_modules.c @@ -3726,7 +3726,7 @@ void pool_at_command_success(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *ba if (IsA(node, CreateStmt)) { CreateStmt *create_table_stmt = (CreateStmt *)node; - if (create_table_stmt->relation->relpersistence) + if (create_table_stmt->relation->relpersistence == 't') discard_temp_table_relcache(); } }