pgpool2.git / summary / log / commit / refs
commit 3678154436fa6f2851561ed1ddfc792bbeeb6e74
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Mon Apr 09 10:54:14 2012 +0000
Fix memory leak. If query result was returned from cache, query contex
was not destroyed. In this case there's no point to create query
context in the first place. So skip creating query context.
pool_proto_modules.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/pool_proto_modules.c b/pool_proto_modules.c
index b455be200..5935482e3 100644
--- a/pool_proto_modules.c
+++ b/pool_proto_modules.c
@@ -144,14 +144,6 @@ POOL_STATUS SimpleQuery(POOL_CONNECTION *frontend,
pool_debug("statement2: %s", contents);
}
- /* Create query context */
- query_context = pool_init_query_context();
- if (!query_context)
- {
- pool_error("SimpleQuery: pool_init_query_context failed");
- return POOL_END;
- }
-
/*
* Fetch memory cache if possible
*/
@@ -174,6 +166,14 @@ POOL_STATUS SimpleQuery(POOL_CONNECTION *frontend,
}
}
+ /* Create query context */
+ query_context = pool_init_query_context();
+ if (!query_context)
+ {
+ pool_error("SimpleQuery: pool_init_query_context failed");
+ return POOL_END;
+ }
+
/* switch memory context */
if (pool_memory == NULL)
pool_memory = pool_memory_create(PARSER_BLOCK_SIZE);
[parent: 99f3bf38fa4d]