From fee6fd7f65a0281bbb20161ba522df80f8a3d05f Mon Sep 17 00:00:00 2001
From: Michael Meskes <meskes@postgresql.org>
Date: Tue, 8 Jul 2003 07:13:48 +0000
Subject: [PATCH] Fix segfault in connect in informix mode.

---
 src/interfaces/ecpg/ChangeLog         | 4 ++++
 src/interfaces/ecpg/ecpglib/connect.c | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 33651faea4a..2b33f1f487d 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -1554,6 +1554,10 @@ Fri Jul  4 13:51:11 CEST 2003
 Mon Jul  7 14:13:43 CEST 2003
 
 	- Made sure "char *" is handled differently than "char []".
+	
+Tue Jul  8 09:04:31 CEST 2003
+
+	- Fixed segfault in ECPGconnect in Informix mode.
 	- Set ecpg version to 3.0.0
 	- Set ecpg library to 4.0.0
 	- Set pgtypes library to 1.0.0
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index d7c721acd33..433a5e29602 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.10 2003/07/01 12:40:51 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.11 2003/07/08 07:13:48 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -324,8 +324,8 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
 		envname = getenv("PG_DBPATH");
 		if (envname)
 		{
-			free(dbname);
-			dbname = envname;
+			ECPGfree(dbname);
+			dbname = strdup(envname);
 		}
 					
 	}
-- 
GitLab