You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by zt...@apache.org on 2022/11/24 07:42:22 UTC

[hawq] branch master updated: HAWQ-1841. Fix early free on savedSeqServerHost

This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hawq.git


The following commit(s) were added to refs/heads/master by this push:
     new c3f4e25d6 HAWQ-1841. Fix early free on savedSeqServerHost
c3f4e25d6 is described below

commit c3f4e25d61fa4181d7ddd642fb199de6eadf023d
Author: ztao1987 <zh...@gmail.com>
AuthorDate: Thu Nov 24 15:41:53 2022 +0800

    HAWQ-1841. Fix early free on savedSeqServerHost
---
 src/backend/cdb/motion/ic_common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/backend/cdb/motion/ic_common.c b/src/backend/cdb/motion/ic_common.c
index b5a222ee4..4defd2d01 100644
--- a/src/backend/cdb/motion/ic_common.c
+++ b/src/backend/cdb/motion/ic_common.c
@@ -630,7 +630,7 @@ SetupSequenceServer(const char *host, int port)
 		 * See MPP-10162: certain PL/PGSQL functions may call us multiple
 		 * times without an intervening Teardown.
 		 */
-		if (savedSeqServerHost != NULL)
+		if (savedSeqServerHost != NULL && savedSeqServerHost != host)
 		{
 			free(savedSeqServerHost);
 			savedSeqServerHost = NULL;
@@ -641,7 +641,9 @@ SetupSequenceServer(const char *host, int port)
 		 * Don't use MemoryContexts -- they make error handling
 		 * difficult here.
 		 */
-		savedSeqServerHost = strdup(host);
+		if (savedSeqServerHost != host) {
+			savedSeqServerHost = strdup(host);
+		}
 
 		if (savedSeqServerHost == NULL)
 		{