pgpool2.git / summary / log / commit / refs
commit 7fe9460985088eda9cd49de00a239d019ec4004f
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Thu Nov 12 07:04:03 2009 +0000
Prepare for bind_rewrite_timestamp() returns NULL case. This could
happen if SELECT now() is called inside an aborted transaction.
Fix SimpleForwardToBackend free rewrite_msg too early.
pool_process_query.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/pool_process_query.c b/pool_process_query.c
index 27a3a3142..3d6bce95b 100644
--- a/pool_process_query.c
+++ b/pool_process_query.c
@@ -1948,8 +1948,12 @@ POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, POOL_CO
/* rewrite bind message */
if (REPLICATION && portal && portal->num_tsparams > 0)
{
- p = rewrite_msg = bind_rewrite_timestamp(backend, portal, p, &len);
- sendlen = htonl(len + 4);
+ rewrite_msg = bind_rewrite_timestamp(backend, portal, p, &len);
+ if (rewrite_msg != NULL)
+ {
+ p = rewrite_msg;
+ sendlen = htonl(len + 4);
+ }
}
}
@@ -1976,7 +1980,6 @@ POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, POOL_CO
}
}
}
- free(rewrite_msg);
if (kind == 'B') /* Bind message */
{
@@ -2004,6 +2007,7 @@ POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, POOL_CO
free(portal->portal_name);
portal->portal_name = strdup(portal_name);
}
+ free(rewrite_msg);
}
/* Close message with prepared statement name. */
[parent: 7743440ae4e3]